import{N as ut}from"./NewsLetterSubscription-DQhV9I49.js";import{f as R,d as F,a as k,o as m,c as f,b as a,t as p,w as P,v as M,n as E,j as S,F as dt,r as ht,e as oe,U as he,u as Ae}from"./vue.esm-bundler-DvMSP5T_.js";import{b as Le}from"./helpers-CQTP1zDs.js";const pt="modulepreload",mt=function(i){return"/build/"+i},Ue={},gt=function(e,t,s){let r=Promise.resolve();if(t&&t.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),l=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));r=Promise.allSettled(t.map(c=>{if(c=mt(c),c in Ue)return;Ue[c]=!0;const d=c.endsWith(".css"),u=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${u}`))return;const h=document.createElement("link");if(h.rel=d?"stylesheet":pt,d||(h.as="script"),h.crossOrigin="",h.href=c,l&&h.setAttribute("nonce",l),document.head.appendChild(h),d)return new Promise((g,w)=>{h.addEventListener("load",g),h.addEventListener("error",()=>w(new Error(`Unable to preload CSS for ${c}`)))})}))}function n(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return r.then(o=>{for(const l of o||[])l.status==="rejected"&&n(l.reason);return e().catch(n)})},ft=i=>{let e;return i?e=i:typeof fetch>"u"?e=(...t)=>Promise.resolve().then(()=>le).then(({default:s})=>s(...t)):e=fetch,(...t)=>e(...t)};class Te extends Error{constructor(e,t="FunctionsError",s){super(e),this.name=t,this.context=s}}class wt extends Te{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class yt extends Te{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class bt extends Te{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var _e;(function(i){i.Any="any",i.ApNortheast1="ap-northeast-1",i.ApNortheast2="ap-northeast-2",i.ApSouth1="ap-south-1",i.ApSoutheast1="ap-southeast-1",i.ApSoutheast2="ap-southeast-2",i.CaCentral1="ca-central-1",i.EuCentral1="eu-central-1",i.EuWest1="eu-west-1",i.EuWest2="eu-west-2",i.EuWest3="eu-west-3",i.SaEast1="sa-east-1",i.UsEast1="us-east-1",i.UsWest1="us-west-1",i.UsWest2="us-west-2"})(_e||(_e={}));var vt=function(i,e,t,s){function r(n){return n instanceof t?n:new t(function(o){o(n)})}return new(t||(t=Promise))(function(n,o){function l(u){try{d(s.next(u))}catch(h){o(h)}}function c(u){try{d(s.throw(u))}catch(h){o(h)}}function d(u){u.done?n(u.value):r(u.value).then(l,c)}d((s=s.apply(i,[])).next())})};class _t{constructor(e,{headers:t={},customFetch:s,region:r=_e.Any}={}){this.url=e,this.headers=t,this.region=r,this.fetch=ft(s)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e,t={}){var s;return vt(this,void 0,void 0,function*(){try{const{headers:r,method:n,body:o}=t;let l={},{region:c}=t;c||(c=this.region),c&&c!=="any"&&(l["x-region"]=c);let d;o&&(r&&!Object.prototype.hasOwnProperty.call(r,"Content-Type")||!r)&&(typeof Blob<"u"&&o instanceof Blob||o instanceof ArrayBuffer?(l["Content-Type"]="application/octet-stream",d=o):typeof o=="string"?(l["Content-Type"]="text/plain",d=o):typeof FormData<"u"&&o instanceof FormData?d=o:(l["Content-Type"]="application/json",d=JSON.stringify(o)));const u=yield this.fetch(`${this.url}/${e}`,{method:n||"POST",headers:Object.assign(Object.assign(Object.assign({},l),this.headers),r),body:d}).catch(y=>{throw new wt(y)}),h=u.headers.get("x-relay-error");if(h&&h==="true")throw new yt(u);if(!u.ok)throw new bt(u);let g=((s=u.headers.get("Content-Type"))!==null&&s!==void 0?s:"text/plain").split(";")[0].trim(),w;return g==="application/json"?w=yield u.json():g==="application/octet-stream"?w=yield u.blob():g==="text/event-stream"?w=u:g==="multipart/form-data"?w=yield u.formData():w=yield u.text(),{data:w,error:null}}catch(r){return{data:null,error:r}}})}}var kt=function(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("unable to locate global object")},ee=kt();const xt=ee.fetch,Pe=ee.fetch.bind(ee),Xe=ee.Headers,Ct=ee.Request,St=ee.Response,le=Object.freeze(Object.defineProperty({__proto__:null,Headers:Xe,Request:Ct,Response:St,default:Pe,fetch:xt},Symbol.toStringTag,{value:"Module"}));class Et extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}}class Tt{constructor(e){this.shouldThrowOnError=!1,this.method=e.method,this.url=e.url,this.headers=e.headers,this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=e.shouldThrowOnError,this.signal=e.signal,this.isMaybeSingle=e.isMaybeSingle,e.fetch?this.fetch=e.fetch:typeof fetch>"u"?this.fetch=Pe:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}then(e,t){this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers["Accept-Profile"]=this.schema:this.headers["Content-Profile"]=this.schema),this.method!=="GET"&&this.method!=="HEAD"&&(this.headers["Content-Type"]="application/json");const s=this.fetch;let r=s(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async n=>{var o,l,c;let d=null,u=null,h=null,g=n.status,w=n.statusText;if(n.ok){if(this.method!=="HEAD"){const C=await n.text();C===""||(this.headers.Accept==="text/csv"||this.headers.Accept&&this.headers.Accept.includes("application/vnd.pgrst.plan+text")?u=C:u=JSON.parse(C))}const y=(o=this.headers.Prefer)===null||o===void 0?void 0:o.match(/count=(exact|planned|estimated)/),x=(l=n.headers.get("content-range"))===null||l===void 0?void 0:l.split("/");y&&x&&x.length>1&&(h=parseInt(x[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(u)&&(u.length>1?(d={code:"PGRST116",details:`Results contain ${u.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},u=null,h=null,g=406,w="Not Acceptable"):u.length===1?u=u[0]:u=null)}else{const y=await n.text();try{d=JSON.parse(y),Array.isArray(d)&&n.status===404&&(u=[],d=null,g=200,w="OK")}catch{n.status===404&&y===""?(g=204,w="No Content"):d={message:y}}if(d&&this.isMaybeSingle&&!((c=d==null?void 0:d.details)===null||c===void 0)&&c.includes("0 rows")&&(d=null,g=200,w="OK"),d&&this.shouldThrowOnError)throw new Et(d)}return{error:d,data:u,count:h,status:g,statusText:w}});return this.shouldThrowOnError||(r=r.catch(n=>{var o,l,c;return{error:{message:`${(o=n==null?void 0:n.name)!==null&&o!==void 0?o:"FetchError"}: ${n==null?void 0:n.message}`,details:`${(l=n==null?void 0:n.stack)!==null&&l!==void 0?l:""}`,hint:"",code:`${(c=n==null?void 0:n.code)!==null&&c!==void 0?c:""}`},data:null,count:null,status:0,statusText:""}})),r.then(e,t)}}class Pt extends Tt{select(e){let t=!1;const s=(e??"*").split("").map(r=>/\s/.test(r)&&!t?"":(r==='"'&&(t=!t),r)).join("");return this.url.searchParams.set("select",s),this.headers.Prefer&&(this.headers.Prefer+=","),this.headers.Prefer+="return=representation",this}order(e,{ascending:t=!0,nullsFirst:s,foreignTable:r,referencedTable:n=r}={}){const o=n?`${n}.order`:"order",l=this.url.searchParams.get(o);return this.url.searchParams.set(o,`${l?`${l},`:""}${e}.${t?"asc":"desc"}${s===void 0?"":s?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:t,referencedTable:s=t}={}){const r=typeof s>"u"?"limit":`${s}.limit`;return this.url.searchParams.set(r,`${e}`),this}range(e,t,{foreignTable:s,referencedTable:r=s}={}){const n=typeof r>"u"?"offset":`${r}.offset`,o=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(n,`${e}`),this.url.searchParams.set(o,`${t-e+1}`),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.Accept="application/vnd.pgrst.object+json",this}maybeSingle(){return this.method==="GET"?this.headers.Accept="application/json":this.headers.Accept="application/vnd.pgrst.object+json",this.isMaybeSingle=!0,this}csv(){return this.headers.Accept="text/csv",this}geojson(){return this.headers.Accept="application/geo+json",this}explain({analyze:e=!1,verbose:t=!1,settings:s=!1,buffers:r=!1,wal:n=!1,format:o="text"}={}){var l;const c=[e?"analyze":null,t?"verbose":null,s?"settings":null,r?"buffers":null,n?"wal":null].filter(Boolean).join("|"),d=(l=this.headers.Accept)!==null&&l!==void 0?l:"application/json";return this.headers.Accept=`application/vnd.pgrst.plan+${o}; for="${d}"; options=${c};`,o==="json"?this:this}rollback(){var e;return((e=this.headers.Prefer)!==null&&e!==void 0?e:"").trim().length>0?this.headers.Prefer+=",tx=rollback":this.headers.Prefer="tx=rollback",this}returns(){return this}}class X extends Pt{eq(e,t){return this.url.searchParams.append(e,`eq.${t}`),this}neq(e,t){return this.url.searchParams.append(e,`neq.${t}`),this}gt(e,t){return this.url.searchParams.append(e,`gt.${t}`),this}gte(e,t){return this.url.searchParams.append(e,`gte.${t}`),this}lt(e,t){return this.url.searchParams.append(e,`lt.${t}`),this}lte(e,t){return this.url.searchParams.append(e,`lte.${t}`),this}like(e,t){return this.url.searchParams.append(e,`like.${t}`),this}likeAllOf(e,t){return this.url.searchParams.append(e,`like(all).{${t.join(",")}}`),this}likeAnyOf(e,t){return this.url.searchParams.append(e,`like(any).{${t.join(",")}}`),this}ilike(e,t){return this.url.searchParams.append(e,`ilike.${t}`),this}ilikeAllOf(e,t){return this.url.searchParams.append(e,`ilike(all).{${t.join(",")}}`),this}ilikeAnyOf(e,t){return this.url.searchParams.append(e,`ilike(any).{${t.join(",")}}`),this}is(e,t){return this.url.searchParams.append(e,`is.${t}`),this}in(e,t){const s=Array.from(new Set(t)).map(r=>typeof r=="string"&&new RegExp("[,()]").test(r)?`"${r}"`:`${r}`).join(",");return this.url.searchParams.append(e,`in.(${s})`),this}contains(e,t){return typeof t=="string"?this.url.searchParams.append(e,`cs.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cs.{${t.join(",")}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(t)}`),this}containedBy(e,t){return typeof t=="string"?this.url.searchParams.append(e,`cd.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cd.{${t.join(",")}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(t)}`),this}rangeGt(e,t){return this.url.searchParams.append(e,`sr.${t}`),this}rangeGte(e,t){return this.url.searchParams.append(e,`nxl.${t}`),this}rangeLt(e,t){return this.url.searchParams.append(e,`sl.${t}`),this}rangeLte(e,t){return this.url.searchParams.append(e,`nxr.${t}`),this}rangeAdjacent(e,t){return this.url.searchParams.append(e,`adj.${t}`),this}overlaps(e,t){return typeof t=="string"?this.url.searchParams.append(e,`ov.${t}`):this.url.searchParams.append(e,`ov.{${t.join(",")}}`),this}textSearch(e,t,{config:s,type:r}={}){let n="";r==="plain"?n="pl":r==="phrase"?n="ph":r==="websearch"&&(n="w");const o=s===void 0?"":`(${s})`;return this.url.searchParams.append(e,`${n}fts${o}.${t}`),this}match(e){return Object.entries(e).forEach(([t,s])=>{this.url.searchParams.append(t,`eq.${s}`)}),this}not(e,t,s){return this.url.searchParams.append(e,`not.${t}.${s}`),this}or(e,{foreignTable:t,referencedTable:s=t}={}){const r=s?`${s}.or`:"or";return this.url.searchParams.append(r,`(${e})`),this}filter(e,t,s){return this.url.searchParams.append(e,`${t}.${s}`),this}}class jt{constructor(e,{headers:t={},schema:s,fetch:r}){this.url=e,this.headers=t,this.schema=s,this.fetch=r}select(e,{head:t=!1,count:s}={}){const r=t?"HEAD":"GET";let n=!1;const o=(e??"*").split("").map(l=>/\s/.test(l)&&!n?"":(l==='"'&&(n=!n),l)).join("");return this.url.searchParams.set("select",o),s&&(this.headers.Prefer=`count=${s}`),new X({method:r,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch,allowEmpty:!1})}insert(e,{count:t,defaultToNull:s=!0}={}){const r="POST",n=[];if(this.headers.Prefer&&n.push(this.headers.Prefer),t&&n.push(`count=${t}`),s||n.push("missing=default"),this.headers.Prefer=n.join(","),Array.isArray(e)){const o=e.reduce((l,c)=>l.concat(Object.keys(c)),[]);if(o.length>0){const l=[...new Set(o)].map(c=>`"${c}"`);this.url.searchParams.set("columns",l.join(","))}}return new X({method:r,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:this.fetch,allowEmpty:!1})}upsert(e,{onConflict:t,ignoreDuplicates:s=!1,count:r,defaultToNull:n=!0}={}){const o="POST",l=[`resolution=${s?"ignore":"merge"}-duplicates`];if(t!==void 0&&this.url.searchParams.set("on_conflict",t),this.headers.Prefer&&l.push(this.headers.Prefer),r&&l.push(`count=${r}`),n||l.push("missing=default"),this.headers.Prefer=l.join(","),Array.isArray(e)){const c=e.reduce((d,u)=>d.concat(Object.keys(u)),[]);if(c.length>0){const d=[...new Set(c)].map(u=>`"${u}"`);this.url.searchParams.set("columns",d.join(","))}}return new X({method:o,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:this.fetch,allowEmpty:!1})}update(e,{count:t}={}){const s="PATCH",r=[];return this.headers.Prefer&&r.push(this.headers.Prefer),t&&r.push(`count=${t}`),this.headers.Prefer=r.join(","),new X({method:s,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:this.fetch,allowEmpty:!1})}delete({count:e}={}){const t="DELETE",s=[];return e&&s.push(`count=${e}`),this.headers.Prefer&&s.unshift(this.headers.Prefer),this.headers.Prefer=s.join(","),new X({method:t,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch,allowEmpty:!1})}}const It="1.15.2",$t={"X-Client-Info":`postgrest-js/${It}`};class je{constructor(e,{headers:t={},schema:s,fetch:r}={}){this.url=e,this.headers=Object.assign(Object.assign({},$t),t),this.schemaName=s,this.fetch=r}from(e){const t=new URL(`${this.url}/${e}`);return new jt(t,{headers:Object.assign({},this.headers),schema:this.schemaName,fetch:this.fetch})}schema(e){return new je(this.url,{headers:this.headers,schema:e,fetch:this.fetch})}rpc(e,t={},{head:s=!1,get:r=!1,count:n}={}){let o;const l=new URL(`${this.url}/rpc/${e}`);let c;s||r?(o=s?"HEAD":"GET",Object.entries(t).filter(([u,h])=>h!==void 0).map(([u,h])=>[u,Array.isArray(h)?`{${h.join(",")}}`:`${h}`]).forEach(([u,h])=>{l.searchParams.append(u,h)})):(o="POST",c=t);const d=Object.assign({},this.headers);return n&&(d.Prefer=`count=${n}`),new X({method:o,url:l,headers:d,schema:this.schemaName,body:c,fetch:this.fetch,allowEmpty:!1})}}const Ot="2.9.5",At={"X-Client-Info":`realtime-js/${Ot}`},Lt="1.0.0",Qe=1e4,Ut=1e3;var Q;(function(i){i[i.connecting=0]="connecting",i[i.open=1]="open",i[i.closing=2]="closing",i[i.closed=3]="closed"})(Q||(Q={}));var I;(function(i){i.closed="closed",i.errored="errored",i.joined="joined",i.joining="joining",i.leaving="leaving"})(I||(I={}));var A;(function(i){i.close="phx_close",i.error="phx_error",i.join="phx_join",i.reply="phx_reply",i.leave="phx_leave",i.access_token="access_token"})(A||(A={}));var ke;(function(i){i.websocket="websocket"})(ke||(ke={}));var J;(function(i){i.Connecting="connecting",i.Open="open",i.Closing="closing",i.Closed="closed"})(J||(J={}));class et{constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=void 0,this.tries=0,this.callback=e,this.timerCalc=t}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}}class Rt{constructor(){this.HEADER_LENGTH=1}decode(e,t){return e.constructor===ArrayBuffer?t(this._binaryDecode(e)):t(typeof e=="string"?JSON.parse(e):{})}_binaryDecode(e){const t=new DataView(e),s=new TextDecoder;return this._decodeBroadcast(e,t,s)}_decodeBroadcast(e,t,s){const r=t.getUint8(1),n=t.getUint8(2);let o=this.HEADER_LENGTH+2;const l=s.decode(e.slice(o,o+r));o=o+r;const c=s.decode(e.slice(o,o+n));o=o+n;const d=JSON.parse(s.decode(e.slice(o,e.byteLength)));return{ref:null,topic:l,event:c,payload:d}}}class ge{constructor(e,t,s={},r=Qe){this.channel=e,this.event=t,this.payload=s,this.timeout=r,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(e){this.timeout=e,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,this.send()}send(){this._hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload,ref:this.ref,join_ref:this.channel._joinRef()}))}updatePayload(e){this.payload=Object.assign(Object.assign({},this.payload),e)}receive(e,t){var s;return this._hasReceived(e)&&t((s=this.receivedResp)===null||s===void 0?void 0:s.response),this.recHooks.push({status:e,callback:t}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);const e=t=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=t,this._matchReceive(t)};this.channel._on(this.refEvent,{},e),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(e,t){this.refEvent&&this.channel._trigger(this.refEvent,{status:e,response:t})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:e,response:t}){this.recHooks.filter(s=>s.status===e).forEach(s=>s.callback(t))}_hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}}var Re;(function(i){i.SYNC="sync",i.JOIN="join",i.LEAVE="leave"})(Re||(Re={}));class ie{constructor(e,t){this.channel=e,this.state={},this.pendingDiffs=[],this.joinRef=null,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};const s=(t==null?void 0:t.events)||{state:"presence_state",diff:"presence_diff"};this.channel._on(s.state,{},r=>{const{onJoin:n,onLeave:o,onSync:l}=this.caller;this.joinRef=this.channel._joinRef(),this.state=ie.syncState(this.state,r,n,o),this.pendingDiffs.forEach(c=>{this.state=ie.syncDiff(this.state,c,n,o)}),this.pendingDiffs=[],l()}),this.channel._on(s.diff,{},r=>{const{onJoin:n,onLeave:o,onSync:l}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(r):(this.state=ie.syncDiff(this.state,r,n,o),l())}),this.onJoin((r,n,o)=>{this.channel._trigger("presence",{event:"join",key:r,currentPresences:n,newPresences:o})}),this.onLeave((r,n,o)=>{this.channel._trigger("presence",{event:"leave",key:r,currentPresences:n,leftPresences:o})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(e,t,s,r){const n=this.cloneDeep(e),o=this.transformState(t),l={},c={};return this.map(n,(d,u)=>{o[d]||(c[d]=u)}),this.map(o,(d,u)=>{const h=n[d];if(h){const g=u.map(C=>C.presence_ref),w=h.map(C=>C.presence_ref),y=u.filter(C=>w.indexOf(C.presence_ref)<0),x=h.filter(C=>g.indexOf(C.presence_ref)<0);y.length>0&&(l[d]=y),x.length>0&&(c[d]=x)}else l[d]=u}),this.syncDiff(n,{joins:l,leaves:c},s,r)}static syncDiff(e,t,s,r){const{joins:n,leaves:o}={joins:this.transformState(t.joins),leaves:this.transformState(t.leaves)};return s||(s=()=>{}),r||(r=()=>{}),this.map(n,(l,c)=>{var d;const u=(d=e[l])!==null&&d!==void 0?d:[];if(e[l]=this.cloneDeep(c),u.length>0){const h=e[l].map(w=>w.presence_ref),g=u.filter(w=>h.indexOf(w.presence_ref)<0);e[l].unshift(...g)}s(l,u,c)}),this.map(o,(l,c)=>{let d=e[l];if(!d)return;const u=c.map(h=>h.presence_ref);d=d.filter(h=>u.indexOf(h.presence_ref)<0),e[l]=d,r(l,d,c),d.length===0&&delete e[l]}),e}static map(e,t){return Object.getOwnPropertyNames(e).map(s=>t(s,e[s]))}static transformState(e){return e=this.cloneDeep(e),Object.getOwnPropertyNames(e).reduce((t,s)=>{const r=e[s];return"metas"in r?t[s]=r.metas.map(n=>(n.presence_ref=n.phx_ref,delete n.phx_ref,delete n.phx_ref_prev,n)):t[s]=r,t},{})}static cloneDeep(e){return JSON.parse(JSON.stringify(e))}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}}var _;(function(i){i.abstime="abstime",i.bool="bool",i.date="date",i.daterange="daterange",i.float4="float4",i.float8="float8",i.int2="int2",i.int4="int4",i.int4range="int4range",i.int8="int8",i.int8range="int8range",i.json="json",i.jsonb="jsonb",i.money="money",i.numeric="numeric",i.oid="oid",i.reltime="reltime",i.text="text",i.time="time",i.timestamp="timestamp",i.timestamptz="timestamptz",i.timetz="timetz",i.tsrange="tsrange",i.tstzrange="tstzrange"})(_||(_={}));const Fe=(i,e,t={})=>{var s;const r=(s=t.skipTypes)!==null&&s!==void 0?s:[];return Object.keys(e).reduce((n,o)=>(n[o]=Ft(o,i,e,r),n),{})},Ft=(i,e,t,s)=>{const r=e.find(l=>l.name===i),n=r==null?void 0:r.type,o=t[i];return n&&!s.includes(n)?tt(n,o):xe(o)},tt=(i,e)=>{if(i.charAt(0)==="_"){const t=i.slice(1,i.length);return Nt(e,t)}switch(i){case _.bool:return Mt(e);case _.float4:case _.float8:case _.int2:case _.int4:case _.int8:case _.numeric:case _.oid:return Bt(e);case _.json:case _.jsonb:return Dt(e);case _.timestamp:return qt(e);case _.abstime:case _.date:case _.daterange:case _.int4range:case _.int8range:case _.money:case _.reltime:case _.text:case _.time:case _.timestamptz:case _.timetz:case _.tsrange:case _.tstzrange:return xe(e);default:return xe(e)}},xe=i=>i,Mt=i=>{switch(i){case"t":return!0;case"f":return!1;default:return i}},Bt=i=>{if(typeof i=="string"){const e=parseFloat(i);if(!Number.isNaN(e))return e}return i},Dt=i=>{if(typeof i=="string")try{return JSON.parse(i)}catch(e){return console.log(`JSON parse error: ${e}`),i}return i},Nt=(i,e)=>{if(typeof i!="string")return i;const t=i.length-1,s=i[t];if(i[0]==="{"&&s==="}"){let r;const n=i.slice(1,t);try{r=JSON.parse("["+n+"]")}catch{r=n?n.split(","):[]}return r.map(o=>tt(e,o))}return i},qt=i=>typeof i=="string"?i.replace(" ","T"):i;var Me;(function(i){i.ALL="*",i.INSERT="INSERT",i.UPDATE="UPDATE",i.DELETE="DELETE"})(Me||(Me={}));var Be;(function(i){i.BROADCAST="broadcast",i.PRESENCE="presence",i.POSTGRES_CHANGES="postgres_changes"})(Be||(Be={}));var De;(function(i){i.SUBSCRIBED="SUBSCRIBED",i.TIMED_OUT="TIMED_OUT",i.CLOSED="CLOSED",i.CHANNEL_ERROR="CHANNEL_ERROR"})(De||(De={}));class Ie{constructor(e,t={config:{}},s){this.topic=e,this.params=t,this.socket=s,this.bindings={},this.state=I.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:""}},t.config),this.timeout=this.socket.timeout,this.joinPush=new ge(this,A.join,this.params,this.timeout),this.rejoinTimer=new et(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=I.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(r=>r.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=I.closed,this.socket._remove(this)}),this._onError(r=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,r),this.state=I.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=I.errored,this.rejoinTimer.scheduleTimeout())}),this._on(A.reply,{},(r,n)=>{this._trigger(this._replyEventName(n),r)}),this.presence=new ie(this),this.broadcastEndpointURL=this._broadcastEndpointURL()}subscribe(e,t=this.timeout){var s,r;if(this.socket.isConnected()||this.socket.connect(),this.joinedOnce)throw"tried to subscribe multiple times. 'subscribe' can only be called a single time per channel instance";{const{config:{broadcast:n,presence:o}}=this.params;this._onError(d=>e&&e("CHANNEL_ERROR",d)),this._onClose(()=>e&&e("CLOSED"));const l={},c={broadcast:n,presence:o,postgres_changes:(r=(s=this.bindings.postgres_changes)===null||s===void 0?void 0:s.map(d=>d.filter))!==null&&r!==void 0?r:[]};this.socket.accessToken&&(l.access_token=this.socket.accessToken),this.updateJoinPayload(Object.assign({config:c},l)),this.joinedOnce=!0,this._rejoin(t),this.joinPush.receive("ok",({postgres_changes:d})=>{var u;if(this.socket.accessToken&&this.socket.setAuth(this.socket.accessToken),d===void 0){e&&e("SUBSCRIBED");return}else{const h=this.bindings.postgres_changes,g=(u=h==null?void 0:h.length)!==null&&u!==void 0?u:0,w=[];for(let y=0;y{e&&e("CHANNEL_ERROR",new Error(JSON.stringify(Object.values(d).join(", ")||"error")))}).receive("timeout",()=>{e&&e("TIMED_OUT")})}return this}presenceState(){return this.presence.state}async track(e,t={}){return await this.send({type:"presence",event:"track",payload:e},t.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,t,s){return this._on(e,t,s)}async send(e,t={}){var s,r;if(!this._canPush()&&e.type==="broadcast"){const{event:n,payload:o}=e,l={method:"POST",headers:{apikey:(s=this.socket.apiKey)!==null&&s!==void 0?s:"","Content-Type":"application/json"},body:JSON.stringify({messages:[{topic:this.subTopic,event:n,payload:o}]})};try{return(await this._fetchWithTimeout(this.broadcastEndpointURL,l,(r=t.timeout)!==null&&r!==void 0?r:this.timeout)).ok?"ok":"error"}catch(c){return c.name==="AbortError"?"timed out":"error"}}else return new Promise(n=>{var o,l,c;const d=this._push(e.type,e,t.timeout||this.timeout);e.type==="broadcast"&&!(!((c=(l=(o=this.params)===null||o===void 0?void 0:o.config)===null||l===void 0?void 0:l.broadcast)===null||c===void 0)&&c.ack)&&n("ok"),d.receive("ok",()=>n("ok")),d.receive("error",()=>n("error")),d.receive("timeout",()=>n("timed out"))})}updateJoinPayload(e){this.joinPush.updatePayload(e)}unsubscribe(e=this.timeout){this.state=I.leaving;const t=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(A.close,"leave",this._joinRef())};return this.rejoinTimer.reset(),this.joinPush.destroy(),new Promise(s=>{const r=new ge(this,A.leave,{},e);r.receive("ok",()=>{t(),s("ok")}).receive("timeout",()=>{t(),s("timed out")}).receive("error",()=>{s("error")}),r.send(),this._canPush()||r.trigger("ok",{})})}_broadcastEndpointURL(){let e=this.socket.endPoint;return e=e.replace(/^ws/i,"http"),e=e.replace(/(\/socket\/websocket|\/socket|\/websocket)\/?$/i,""),e.replace(/\/+$/,"")+"/api/broadcast"}async _fetchWithTimeout(e,t,s){const r=new AbortController,n=setTimeout(()=>r.abort(),s),o=await this.socket.fetch(e,Object.assign(Object.assign({},t),{signal:r.signal}));return clearTimeout(n),o}_push(e,t,s=this.timeout){if(!this.joinedOnce)throw`tried to push '${e}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let r=new ge(this,e,t,s);return this._canPush()?r.send():(r.startTimeout(),this.pushBuffer.push(r)),r}_onMessage(e,t,s){return t}_isMember(e){return this.topic===e}_joinRef(){return this.joinPush.ref}_trigger(e,t,s){var r,n;const o=e.toLocaleLowerCase(),{close:l,error:c,leave:d,join:u}=A;if(s&&[l,c,d,u].indexOf(o)>=0&&s!==this._joinRef())return;let h=this._onMessage(o,t,s);if(t&&!h)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(o)?(r=this.bindings.postgres_changes)===null||r===void 0||r.filter(g=>{var w,y,x;return((w=g.filter)===null||w===void 0?void 0:w.event)==="*"||((x=(y=g.filter)===null||y===void 0?void 0:y.event)===null||x===void 0?void 0:x.toLocaleLowerCase())===o}).map(g=>g.callback(h,s)):(n=this.bindings[o])===null||n===void 0||n.filter(g=>{var w,y,x,C,B,D;if(["broadcast","presence","postgres_changes"].includes(o))if("id"in g){const U=g.id,j=(w=g.filter)===null||w===void 0?void 0:w.event;return U&&((y=t.ids)===null||y===void 0?void 0:y.includes(U))&&(j==="*"||(j==null?void 0:j.toLocaleLowerCase())===((x=t.data)===null||x===void 0?void 0:x.type.toLocaleLowerCase()))}else{const U=(B=(C=g==null?void 0:g.filter)===null||C===void 0?void 0:C.event)===null||B===void 0?void 0:B.toLocaleLowerCase();return U==="*"||U===((D=t==null?void 0:t.event)===null||D===void 0?void 0:D.toLocaleLowerCase())}else return g.type.toLocaleLowerCase()===o}).map(g=>{if(typeof h=="object"&&"ids"in h){const w=h.data,{schema:y,table:x,commit_timestamp:C,type:B,errors:D}=w;h=Object.assign(Object.assign({},{schema:y,table:x,commit_timestamp:C,eventType:B,new:{},old:{},errors:D}),this._getPayloadRecords(w))}g.callback(h,s)})}_isClosed(){return this.state===I.closed}_isJoined(){return this.state===I.joined}_isJoining(){return this.state===I.joining}_isLeaving(){return this.state===I.leaving}_replyEventName(e){return`chan_reply_${e}`}_on(e,t,s){const r=e.toLocaleLowerCase(),n={type:r,filter:t,callback:s};return this.bindings[r]?this.bindings[r].push(n):this.bindings[r]=[n],this}_off(e,t){const s=e.toLocaleLowerCase();return this.bindings[s]=this.bindings[s].filter(r=>{var n;return!(((n=r.type)===null||n===void 0?void 0:n.toLocaleLowerCase())===s&&Ie.isEqual(r.filter,t))}),this}static isEqual(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const s in e)if(e[s]!==t[s])return!1;return!0}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(e){this._on(A.close,{},e)}_onError(e){this._on(A.error,{},t=>e(t))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(e=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=I.joining,this.joinPush.resend(e))}_getPayloadRecords(e){const t={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(t.new=Fe(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(t.old=Fe(e.columns,e.old_record)),t}}const Ht=()=>{},Vt=typeof WebSocket<"u";class Gt{constructor(e,t){var s;this.accessToken=null,this.apiKey=null,this.channels=[],this.endPoint="",this.headers=At,this.params={},this.timeout=Qe,this.heartbeatIntervalMs=3e4,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.ref=0,this.logger=Ht,this.conn=null,this.sendBuffer=[],this.serializer=new Rt,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this._resolveFetch=n=>{let o;return n?o=n:typeof fetch>"u"?o=(...l)=>Promise.resolve().then(()=>le).then(({default:c})=>c(...l)):o=fetch,(...l)=>o(...l)},this.endPoint=`${e}/${ke.websocket}`,t!=null&&t.transport?this.transport=t.transport:this.transport=null,t!=null&&t.params&&(this.params=t.params),t!=null&&t.headers&&(this.headers=Object.assign(Object.assign({},this.headers),t.headers)),t!=null&&t.timeout&&(this.timeout=t.timeout),t!=null&&t.logger&&(this.logger=t.logger),t!=null&&t.heartbeatIntervalMs&&(this.heartbeatIntervalMs=t.heartbeatIntervalMs);const r=(s=t==null?void 0:t.params)===null||s===void 0?void 0:s.apikey;r&&(this.accessToken=r,this.apiKey=r),this.reconnectAfterMs=t!=null&&t.reconnectAfterMs?t.reconnectAfterMs:n=>[1e3,2e3,5e3,1e4][n-1]||1e4,this.encode=t!=null&&t.encode?t.encode:(n,o)=>o(JSON.stringify(n)),this.decode=t!=null&&t.decode?t.decode:this.serializer.decode.bind(this.serializer),this.reconnectTimer=new et(async()=>{this.disconnect(),this.connect()},this.reconnectAfterMs),this.fetch=this._resolveFetch(t==null?void 0:t.fetch)}connect(){if(!this.conn){if(this.transport){this.conn=new this.transport(this._endPointURL(),void 0,{headers:this.headers});return}if(Vt){this.conn=new WebSocket(this._endPointURL()),this.setupConnection();return}this.conn=new zt(this._endPointURL(),void 0,{close:()=>{this.conn=null}}),gt(()=>import("./browser-CDZMrkUx-BWSfbLXF.js"),[]).then(e=>e.b).then(({default:e})=>{this.conn=new e(this._endPointURL(),void 0,{headers:this.headers}),this.setupConnection()})}}disconnect(e,t){this.conn&&(this.conn.onclose=function(){},e?this.conn.close(e,t??""):this.conn.close(),this.conn=null,this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.reconnectTimer.reset())}getChannels(){return this.channels}async removeChannel(e){const t=await e.unsubscribe();return this.channels.length===0&&this.disconnect(),t}async removeAllChannels(){const e=await Promise.all(this.channels.map(t=>t.unsubscribe()));return this.disconnect(),e}log(e,t,s){this.logger(e,t,s)}connectionState(){switch(this.conn&&this.conn.readyState){case Q.connecting:return J.Connecting;case Q.open:return J.Open;case Q.closing:return J.Closing;default:return J.Closed}}isConnected(){return this.connectionState()===J.Open}channel(e,t={config:{}}){const s=new Ie(`realtime:${e}`,t,this);return this.channels.push(s),s}push(e){const{topic:t,event:s,payload:r,ref:n}=e,o=()=>{this.encode(e,l=>{var c;(c=this.conn)===null||c===void 0||c.send(l)})};this.log("push",`${t} ${s} (${n})`,r),this.isConnected()?o():this.sendBuffer.push(o)}setAuth(e){this.accessToken=e,this.channels.forEach(t=>{e&&t.updateJoinPayload({access_token:e}),t.joinedOnce&&t._isJoined()&&t._push(A.access_token,{access_token:e})})}_makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}_leaveOpenTopic(e){let t=this.channels.find(s=>s.topic===e&&(s._isJoined()||s._isJoining()));t&&(this.log("transport",`leaving duplicate topic "${e}"`),t.unsubscribe())}_remove(e){this.channels=this.channels.filter(t=>t._joinRef()!==e._joinRef())}setupConnection(){this.conn&&(this.conn.binaryType="arraybuffer",this.conn.onopen=()=>this._onConnOpen(),this.conn.onerror=e=>this._onConnError(e),this.conn.onmessage=e=>this._onConnMessage(e),this.conn.onclose=e=>this._onConnClose(e))}_endPointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:Lt}))}_onConnMessage(e){this.decode(e.data,t=>{let{topic:s,event:r,payload:n,ref:o}=t;(o&&o===this.pendingHeartbeatRef||r===(n==null?void 0:n.type))&&(this.pendingHeartbeatRef=null),this.log("receive",`${n.status||""} ${s} ${r} ${o&&"("+o+")"||""}`,n),this.channels.filter(l=>l._isMember(s)).forEach(l=>l._trigger(r,n,o)),this.stateChangeCallbacks.message.forEach(l=>l(t))})}_onConnOpen(){this.log("transport",`connected to ${this._endPointURL()}`),this._flushSendBuffer(),this.reconnectTimer.reset(),this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this._sendHeartbeat(),this.heartbeatIntervalMs),this.stateChangeCallbacks.open.forEach(e=>e())}_onConnClose(e){this.log("transport","close",e),this._triggerChanError(),this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.reconnectTimer.scheduleTimeout(),this.stateChangeCallbacks.close.forEach(t=>t(e))}_onConnError(e){this.log("transport",e.message),this._triggerChanError(),this.stateChangeCallbacks.error.forEach(t=>t(e))}_triggerChanError(){this.channels.forEach(e=>e._trigger(A.error))}_appendParams(e,t){if(Object.keys(t).length===0)return e;const s=e.match(/\?/)?"&":"?",r=new URLSearchParams(t);return`${e}${s}${r}`}_flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}_sendHeartbeat(){var e;if(this.isConnected()){if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection"),(e=this.conn)===null||e===void 0||e.close(Ut,"hearbeat timeout");return}this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef}),this.setAuth(this.accessToken)}}}class zt{constructor(e,t,s){this.binaryType="arraybuffer",this.onclose=()=>{},this.onerror=()=>{},this.onmessage=()=>{},this.onopen=()=>{},this.readyState=Q.connecting,this.send=()=>{},this.url=null,this.url=e,this.close=s.close}}class $e extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}}function T(i){return typeof i=="object"&&i!==null&&"__isStorageError"in i}class Jt extends $e{constructor(e,t){super(e),this.name="StorageApiError",this.status=t}toJSON(){return{name:this.name,message:this.message,status:this.status}}}class Ne extends $e{constructor(e,t){super(e),this.name="StorageUnknownError",this.originalError=t}}var Zt=function(i,e,t,s){function r(n){return n instanceof t?n:new t(function(o){o(n)})}return new(t||(t=Promise))(function(n,o){function l(u){try{d(s.next(u))}catch(h){o(h)}}function c(u){try{d(s.throw(u))}catch(h){o(h)}}function d(u){u.done?n(u.value):r(u.value).then(l,c)}d((s=s.apply(i,[])).next())})};const st=i=>{let e;return i?e=i:typeof fetch>"u"?e=(...t)=>Promise.resolve().then(()=>le).then(({default:s})=>s(...t)):e=fetch,(...t)=>e(...t)},Kt=()=>Zt(void 0,void 0,void 0,function*(){return typeof Response>"u"?(yield Promise.resolve().then(()=>le)).Response:Response});var te=function(i,e,t,s){function r(n){return n instanceof t?n:new t(function(o){o(n)})}return new(t||(t=Promise))(function(n,o){function l(u){try{d(s.next(u))}catch(h){o(h)}}function c(u){try{d(s.throw(u))}catch(h){o(h)}}function d(u){u.done?n(u.value):r(u.value).then(l,c)}d((s=s.apply(i,[])).next())})};const fe=i=>i.msg||i.message||i.error_description||i.error||JSON.stringify(i),Wt=(i,e)=>te(void 0,void 0,void 0,function*(){const t=yield Kt();i instanceof t?i.json().then(s=>{e(new Jt(fe(s),i.status||500))}).catch(s=>{e(new Ne(fe(s),s))}):e(new Ne(fe(i),i))}),Yt=(i,e,t,s)=>{const r={method:i,headers:(e==null?void 0:e.headers)||{}};return i==="GET"?r:(r.headers=Object.assign({"Content-Type":"application/json"},e==null?void 0:e.headers),r.body=JSON.stringify(s),Object.assign(Object.assign({},r),t))};function pe(i,e,t,s,r,n){return te(this,void 0,void 0,function*(){return new Promise((o,l)=>{i(t,Yt(e,s,r,n)).then(c=>{if(!c.ok)throw c;return s!=null&&s.noResolveJson?c:c.json()}).then(c=>o(c)).catch(c=>Wt(c,l))})})}function Ce(i,e,t,s){return te(this,void 0,void 0,function*(){return pe(i,"GET",e,t,s)})}function q(i,e,t,s,r){return te(this,void 0,void 0,function*(){return pe(i,"POST",e,s,r,t)})}function Xt(i,e,t,s,r){return te(this,void 0,void 0,function*(){return pe(i,"PUT",e,s,r,t)})}function rt(i,e,t,s,r){return te(this,void 0,void 0,function*(){return pe(i,"DELETE",e,s,r,t)})}var $=function(i,e,t,s){function r(n){return n instanceof t?n:new t(function(o){o(n)})}return new(t||(t=Promise))(function(n,o){function l(u){try{d(s.next(u))}catch(h){o(h)}}function c(u){try{d(s.throw(u))}catch(h){o(h)}}function d(u){u.done?n(u.value):r(u.value).then(l,c)}d((s=s.apply(i,[])).next())})};const Qt={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},qe={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};class es{constructor(e,t={},s,r){this.url=e,this.headers=t,this.bucketId=s,this.fetch=st(r)}uploadOrUpdate(e,t,s,r){return $(this,void 0,void 0,function*(){try{let n;const o=Object.assign(Object.assign({},qe),r),l=Object.assign(Object.assign({},this.headers),e==="POST"&&{"x-upsert":String(o.upsert)});typeof Blob<"u"&&s instanceof Blob?(n=new FormData,n.append("cacheControl",o.cacheControl),n.append("",s)):typeof FormData<"u"&&s instanceof FormData?(n=s,n.append("cacheControl",o.cacheControl)):(n=s,l["cache-control"]=`max-age=${o.cacheControl}`,l["content-type"]=o.contentType);const c=this._removeEmptyFolders(t),d=this._getFinalPath(c),u=yield this.fetch(`${this.url}/object/${d}`,Object.assign({method:e,body:n,headers:l},o!=null&&o.duplex?{duplex:o.duplex}:{})),h=yield u.json();return u.ok?{data:{path:c,id:h.Id,fullPath:h.Key},error:null}:{data:null,error:h}}catch(n){if(T(n))return{data:null,error:n};throw n}})}upload(e,t,s){return $(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",e,t,s)})}uploadToSignedUrl(e,t,s,r){return $(this,void 0,void 0,function*(){const n=this._removeEmptyFolders(e),o=this._getFinalPath(n),l=new URL(this.url+`/object/upload/sign/${o}`);l.searchParams.set("token",t);try{let c;const d=Object.assign({upsert:qe.upsert},r),u=Object.assign(Object.assign({},this.headers),{"x-upsert":String(d.upsert)});typeof Blob<"u"&&s instanceof Blob?(c=new FormData,c.append("cacheControl",d.cacheControl),c.append("",s)):typeof FormData<"u"&&s instanceof FormData?(c=s,c.append("cacheControl",d.cacheControl)):(c=s,u["cache-control"]=`max-age=${d.cacheControl}`,u["content-type"]=d.contentType);const h=yield this.fetch(l.toString(),{method:"PUT",body:c,headers:u}),g=yield h.json();return h.ok?{data:{path:n,fullPath:g.Key},error:null}:{data:null,error:g}}catch(c){if(T(c))return{data:null,error:c};throw c}})}createSignedUploadUrl(e){return $(this,void 0,void 0,function*(){try{let t=this._getFinalPath(e);const s=yield q(this.fetch,`${this.url}/object/upload/sign/${t}`,{},{headers:this.headers}),r=new URL(this.url+s.url),n=r.searchParams.get("token");if(!n)throw new $e("No token returned by API");return{data:{signedUrl:r.toString(),path:e,token:n},error:null}}catch(t){if(T(t))return{data:null,error:t};throw t}})}update(e,t,s){return $(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",e,t,s)})}move(e,t){return $(this,void 0,void 0,function*(){try{return{data:yield q(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:e,destinationKey:t},{headers:this.headers}),error:null}}catch(s){if(T(s))return{data:null,error:s};throw s}})}copy(e,t){return $(this,void 0,void 0,function*(){try{return{data:{path:(yield q(this.fetch,`${this.url}/object/copy`,{bucketId:this.bucketId,sourceKey:e,destinationKey:t},{headers:this.headers})).Key},error:null}}catch(s){if(T(s))return{data:null,error:s};throw s}})}createSignedUrl(e,t,s){return $(this,void 0,void 0,function*(){try{let r=this._getFinalPath(e),n=yield q(this.fetch,`${this.url}/object/sign/${r}`,Object.assign({expiresIn:t},s!=null&&s.transform?{transform:s.transform}:{}),{headers:this.headers});const o=s!=null&&s.download?`&download=${s.download===!0?"":s.download}`:"";return n={signedUrl:encodeURI(`${this.url}${n.signedURL}${o}`)},{data:n,error:null}}catch(r){if(T(r))return{data:null,error:r};throw r}})}createSignedUrls(e,t,s){return $(this,void 0,void 0,function*(){try{const r=yield q(this.fetch,`${this.url}/object/sign/${this.bucketId}`,{expiresIn:t,paths:e},{headers:this.headers}),n=s!=null&&s.download?`&download=${s.download===!0?"":s.download}`:"";return{data:r.map(o=>Object.assign(Object.assign({},o),{signedUrl:o.signedURL?encodeURI(`${this.url}${o.signedURL}${n}`):null})),error:null}}catch(r){if(T(r))return{data:null,error:r};throw r}})}download(e,t){return $(this,void 0,void 0,function*(){const s=typeof(t==null?void 0:t.transform)<"u"?"render/image/authenticated":"object",r=this.transformOptsToQueryString((t==null?void 0:t.transform)||{}),n=r?`?${r}`:"";try{const o=this._getFinalPath(e);return{data:yield(yield Ce(this.fetch,`${this.url}/${s}/${o}${n}`,{headers:this.headers,noResolveJson:!0})).blob(),error:null}}catch(o){if(T(o))return{data:null,error:o};throw o}})}getPublicUrl(e,t){const s=this._getFinalPath(e),r=[],n=t!=null&&t.download?`download=${t.download===!0?"":t.download}`:"";n!==""&&r.push(n);const o=typeof(t==null?void 0:t.transform)<"u"?"render/image":"object",l=this.transformOptsToQueryString((t==null?void 0:t.transform)||{});l!==""&&r.push(l);let c=r.join("&");return c!==""&&(c=`?${c}`),{data:{publicUrl:encodeURI(`${this.url}/${o}/public/${s}${c}`)}}}remove(e){return $(this,void 0,void 0,function*(){try{return{data:yield rt(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:e},{headers:this.headers}),error:null}}catch(t){if(T(t))return{data:null,error:t};throw t}})}list(e,t,s){return $(this,void 0,void 0,function*(){try{const r=Object.assign(Object.assign(Object.assign({},Qt),t),{prefix:e||""});return{data:yield q(this.fetch,`${this.url}/object/list/${this.bucketId}`,r,{headers:this.headers},s),error:null}}catch(r){if(T(r))return{data:null,error:r};throw r}})}_getFinalPath(e){return`${this.bucketId}/${e}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(e){const t=[];return e.width&&t.push(`width=${e.width}`),e.height&&t.push(`height=${e.height}`),e.resize&&t.push(`resize=${e.resize}`),e.format&&t.push(`format=${e.format}`),e.quality&&t.push(`quality=${e.quality}`),t.join("&")}}const ts="2.5.5",ss={"X-Client-Info":`storage-js/${ts}`};var K=function(i,e,t,s){function r(n){return n instanceof t?n:new t(function(o){o(n)})}return new(t||(t=Promise))(function(n,o){function l(u){try{d(s.next(u))}catch(h){o(h)}}function c(u){try{d(s.throw(u))}catch(h){o(h)}}function d(u){u.done?n(u.value):r(u.value).then(l,c)}d((s=s.apply(i,[])).next())})};class rs{constructor(e,t={},s){this.url=e,this.headers=Object.assign(Object.assign({},ss),t),this.fetch=st(s)}listBuckets(){return K(this,void 0,void 0,function*(){try{return{data:yield Ce(this.fetch,`${this.url}/bucket`,{headers:this.headers}),error:null}}catch(e){if(T(e))return{data:null,error:e};throw e}})}getBucket(e){return K(this,void 0,void 0,function*(){try{return{data:yield Ce(this.fetch,`${this.url}/bucket/${e}`,{headers:this.headers}),error:null}}catch(t){if(T(t))return{data:null,error:t};throw t}})}createBucket(e,t={public:!1}){return K(this,void 0,void 0,function*(){try{return{data:yield q(this.fetch,`${this.url}/bucket`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:this.headers}),error:null}}catch(s){if(T(s))return{data:null,error:s};throw s}})}updateBucket(e,t){return K(this,void 0,void 0,function*(){try{return{data:yield Xt(this.fetch,`${this.url}/bucket/${e}`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:this.headers}),error:null}}catch(s){if(T(s))return{data:null,error:s};throw s}})}emptyBucket(e){return K(this,void 0,void 0,function*(){try{return{data:yield q(this.fetch,`${this.url}/bucket/${e}/empty`,{},{headers:this.headers}),error:null}}catch(t){if(T(t))return{data:null,error:t};throw t}})}deleteBucket(e){return K(this,void 0,void 0,function*(){try{return{data:yield rt(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(t){if(T(t))return{data:null,error:t};throw t}})}}class is extends rs{constructor(e,t={},s){super(e,t,s)}from(e){return new es(this.url,this.headers,e,this.fetch)}}const ns="2.43.4";let re="";typeof Deno<"u"?re="deno":typeof document<"u"?re="web":typeof navigator<"u"&&navigator.product==="ReactNative"?re="react-native":re="node";const os={"X-Client-Info":`supabase-js-${re}/${ns}`},as={headers:os},ls={schema:"public"},cs={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},us={};var ds=function(i,e,t,s){function r(n){return n instanceof t?n:new t(function(o){o(n)})}return new(t||(t=Promise))(function(n,o){function l(u){try{d(s.next(u))}catch(h){o(h)}}function c(u){try{d(s.throw(u))}catch(h){o(h)}}function d(u){u.done?n(u.value):r(u.value).then(l,c)}d((s=s.apply(i,[])).next())})};const hs=i=>{let e;return i?e=i:typeof fetch>"u"?e=Pe:e=fetch,(...t)=>e(...t)},ps=()=>typeof Headers>"u"?Xe:Headers,ms=(i,e,t)=>{const s=hs(t),r=ps();return(n,o)=>ds(void 0,void 0,void 0,function*(){var l;const c=(l=yield e())!==null&&l!==void 0?l:i;let d=new r(o==null?void 0:o.headers);return d.has("apikey")||d.set("apikey",i),d.has("Authorization")||d.set("Authorization",`Bearer ${c}`),s(n,Object.assign(Object.assign({},o),{headers:d}))})};function gs(i){return i.replace(/\/$/,"")}function fs(i,e){const{db:t,auth:s,realtime:r,global:n}=i,{db:o,auth:l,realtime:c,global:d}=e;return{db:Object.assign(Object.assign({},o),t),auth:Object.assign(Object.assign({},l),s),realtime:Object.assign(Object.assign({},c),r),global:Object.assign(Object.assign({},d),n)}}const it="2.64.2",ws="http://localhost:9999",ys="supabase.auth.token",bs={"X-Client-Info":`gotrue-js/${it}`},He=10,Se="X-Supabase-Api-Version",nt={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}};function vs(i){return Math.round(Date.now()/1e3)+i}function _s(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(i){const e=Math.random()*16|0;return(i=="x"?e:e&3|8).toString(16)})}const O=()=>typeof document<"u",V={tested:!1,writable:!1},ne=()=>{if(!O())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(V.tested)return V.writable;const i=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(i,i),globalThis.localStorage.removeItem(i),V.tested=!0,V.writable=!0}catch{V.tested=!0,V.writable=!1}return V.writable};function we(i){const e={},t=new URL(i);if(t.hash&&t.hash[0]==="#")try{new URLSearchParams(t.hash.substring(1)).forEach((s,r)=>{e[r]=s})}catch{}return t.searchParams.forEach((s,r)=>{e[r]=s}),e}const ot=i=>{let e;return i?e=i:typeof fetch>"u"?e=(...t)=>Promise.resolve().then(()=>le).then(({default:s})=>s(...t)):e=fetch,(...t)=>e(...t)},ks=i=>typeof i=="object"&&i!==null&&"status"in i&&"ok"in i&&"json"in i&&typeof i.json=="function",at=async(i,e,t)=>{await i.setItem(e,JSON.stringify(t))},ce=async(i,e)=>{const t=await i.getItem(e);if(!t)return null;try{return JSON.parse(t)}catch{return t}},ye=async(i,e)=>{await i.removeItem(e)};function xs(i){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";let t="",s,r,n,o,l,c,d,u=0;for(i=i.replace("-","+").replace("_","/");u>4,r=(l&15)<<4|c>>2,n=(c&3)<<6|d,t=t+String.fromCharCode(s),c!=64&&r!=0&&(t=t+String.fromCharCode(r)),d!=64&&n!=0&&(t=t+String.fromCharCode(n));return t}class me{constructor(){this.promise=new me.promiseConstructor((e,t)=>{this.resolve=e,this.reject=t})}}me.promiseConstructor=Promise;function Ve(i){const e=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}=?$|[a-z0-9_-]{2}(==)?$)$/i,t=i.split(".");if(t.length!==3)throw new Error("JWT is not valid: not a JWT structure");if(!e.test(t[1]))throw new Error("JWT is not valid: payload is not in base64url format");const s=t[1];return JSON.parse(xs(s))}async function Cs(i){return await new Promise(e=>{setTimeout(()=>e(null),i)})}function Ss(i,e){return new Promise((t,s)=>{(async()=>{for(let r=0;r<1/0;r++)try{const n=await i(r);if(!e(r,null,n)){t(n);return}}catch(n){if(!e(r,n)){s(n);return}}})()})}function Es(i){return("0"+i.toString(16)).substr(-2)}function Ts(){const i=new Uint32Array(56);if(typeof crypto>"u"){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",t=e.length;let s="";for(let r=0;r<56;r++)s+=e.charAt(Math.floor(Math.random()*t));return s}return crypto.getRandomValues(i),Array.from(i,Es).join("")}async function Ps(i){const e=new TextEncoder().encode(i),t=await crypto.subtle.digest("SHA-256",e),s=new Uint8Array(t);return Array.from(s).map(r=>String.fromCharCode(r)).join("")}function js(i){return btoa(i).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Is(i){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),i;const e=await Ps(i);return js(e)}async function W(i,e,t=!1){const s=Ts();let r=s;t&&(r+="/PASSWORD_RECOVERY"),await at(i,`${e}-code-verifier`,r);const n=await Is(s);return[n,s===n?"plain":"s256"]}const $s=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function Os(i){const e=i.headers.get(Se);if(!e||!e.match($s))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}class Oe extends Error{constructor(e,t,s){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=t,this.code=s}}function b(i){return typeof i=="object"&&i!==null&&"__isAuthError"in i}class As extends Oe{constructor(e,t,s){super(e,t,s),this.name="AuthApiError",this.status=t,this.code=s}}function Ls(i){return b(i)&&i.name==="AuthApiError"}class lt extends Oe{constructor(e,t){super(e),this.name="AuthUnknownError",this.originalError=t}}class Z extends Oe{constructor(e,t,s,r){super(e,s,r),this.name=t,this.status=s}}class G extends Z{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}class be extends Z{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class ue extends Z{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class de extends Z{constructor(e,t=null){super(e,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=t}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class Ge extends Z{constructor(e,t=null){super(e,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=t}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class Ee extends Z{constructor(e,t){super(e,"AuthRetryableFetchError",t,void 0)}}function ve(i){return b(i)&&i.name==="AuthRetryableFetchError"}class ze extends Z{constructor(e,t,s){super(e,"AuthWeakPasswordError",t,"weak_password"),this.reasons=s}}var Us=function(i,e){var t={};for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&e.indexOf(s)<0&&(t[s]=i[s]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,s=Object.getOwnPropertySymbols(i);ri.msg||i.message||i.error_description||i.error||JSON.stringify(i),Rs=[502,503,504];async function Je(i){var e;if(!ks(i))throw new Ee(z(i),0);if(Rs.includes(i.status))throw new Ee(z(i),i.status);let t;try{t=await i.json()}catch(n){throw new lt(z(n),n)}let s;const r=Os(i);if(r&&r.getTime()>=nt["2024-01-01"].timestamp&&typeof t=="object"&&t&&typeof t.code=="string"?s=t.code:typeof t=="object"&&t&&typeof t.error_code=="string"&&(s=t.error_code),s){if(s==="weak_password")throw new ze(z(t),i.status,((e=t.weak_password)===null||e===void 0?void 0:e.reasons)||[])}else if(typeof t=="object"&&t&&typeof t.weak_password=="object"&&t.weak_password&&Array.isArray(t.weak_password.reasons)&&t.weak_password.reasons.length&&t.weak_password.reasons.reduce((n,o)=>n&&typeof o=="string",!0))throw new ze(z(t),i.status,t.weak_password.reasons);throw new As(z(t),i.status||500,s)}const Fs=(i,e,t,s)=>{const r={method:i,headers:(e==null?void 0:e.headers)||{}};return i==="GET"?r:(r.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},e==null?void 0:e.headers),r.body=JSON.stringify(s),Object.assign(Object.assign({},r),t))};async function v(i,e,t,s){var r;const n=Object.assign({},s==null?void 0:s.headers);n[Se]||(n[Se]=nt["2024-01-01"].name),s!=null&&s.jwt&&(n.Authorization=`Bearer ${s.jwt}`);const o=(r=s==null?void 0:s.query)!==null&&r!==void 0?r:{};s!=null&&s.redirectTo&&(o.redirect_to=s.redirectTo);const l=Object.keys(o).length?"?"+new URLSearchParams(o).toString():"",c=await Ms(i,e,t+l,{headers:n,noResolveJson:s==null?void 0:s.noResolveJson},{},s==null?void 0:s.body);return s!=null&&s.xform?s==null?void 0:s.xform(c):{data:Object.assign({},c),error:null}}async function Ms(i,e,t,s,r,n){const o=Fs(e,s,r,n);let l;try{l=await i(t,Object.assign({},o))}catch(c){throw console.error(c),new Ee(z(c),0)}if(l.ok||await Je(l),s!=null&&s.noResolveJson)return l;try{return await l.json()}catch(c){await Je(c)}}function N(i){var e;let t=null;qs(i)&&(t=Object.assign({},i),i.expires_at||(t.expires_at=vs(i.expires_in)));const s=(e=i.user)!==null&&e!==void 0?e:i;return{data:{session:t,user:s},error:null}}function Ze(i){const e=N(i);return!e.error&&i.weak_password&&typeof i.weak_password=="object"&&Array.isArray(i.weak_password.reasons)&&i.weak_password.reasons.length&&i.weak_password.message&&typeof i.weak_password.message=="string"&&i.weak_password.reasons.reduce((t,s)=>t&&typeof s=="string",!0)&&(e.data.weak_password=i.weak_password),e}function H(i){var e;return{data:{user:(e=i.user)!==null&&e!==void 0?e:i},error:null}}function Bs(i){return{data:i,error:null}}function Ds(i){const{action_link:e,email_otp:t,hashed_token:s,redirect_to:r,verification_type:n}=i,o=Us(i,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),l={action_link:e,email_otp:t,hashed_token:s,redirect_to:r,verification_type:n},c=Object.assign({},o);return{data:{properties:l,user:c},error:null}}function Ns(i){return i}function qs(i){return i.access_token&&i.refresh_token&&i.expires_in}var Hs=function(i,e){var t={};for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&e.indexOf(s)<0&&(t[s]=i[s]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,s=Object.getOwnPropertySymbols(i);r0&&(w.forEach(y=>{const x=parseInt(y.split(";")[0].split("=")[1].substring(0,1)),C=JSON.parse(y.split(";")[1].split("=")[1]);d[`${C}Page`]=x}),d.total=parseInt(g)),{data:Object.assign(Object.assign({},h),d),error:null}}catch(d){if(b(d))return{data:{users:[]},error:d};throw d}}async getUserById(e){try{return await v(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:H})}catch(t){if(b(t))return{data:{user:null},error:t};throw t}}async updateUserById(e,t){try{return await v(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:t,headers:this.headers,xform:H})}catch(s){if(b(s))return{data:{user:null},error:s};throw s}}async deleteUser(e,t=!1){try{return await v(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:t},xform:H})}catch(s){if(b(s))return{data:{user:null},error:s};throw s}}async _listFactors(e){try{const{data:t,error:s}=await v(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:r=>({data:{factors:r},error:null})});return{data:t,error:s}}catch(t){if(b(t))return{data:null,error:t};throw t}}async _deleteFactor(e){try{return{data:await v(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(t){if(b(t))return{data:null,error:t};throw t}}}const Gs={getItem:i=>ne()?globalThis.localStorage.getItem(i):null,setItem:(i,e)=>{ne()&&globalThis.localStorage.setItem(i,e)},removeItem:i=>{ne()&&globalThis.localStorage.removeItem(i)}};function Ke(i={}){return{getItem:e=>i[e]||null,setItem:(e,t)=>{i[e]=t},removeItem:e=>{delete i[e]}}}function zs(){if(typeof globalThis!="object")try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch{typeof self<"u"&&(self.globalThis=self)}}const Y={debug:!!(globalThis&&ne()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class ct extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class Js extends ct{}async function Zs(i,e,t){Y.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",i,e);const s=new globalThis.AbortController;return e>0&&setTimeout(()=>{s.abort(),Y.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",i)},e),await globalThis.navigator.locks.request(i,e===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:s.signal},async r=>{if(r){Y.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",i,r.name);try{return await t()}finally{Y.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",i,r.name)}}else{if(e===0)throw Y.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",i),new Js(`Acquiring an exclusive Navigator LockManager lock "${i}" immediately failed`);if(Y.debug)try{const n=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(n,null," "))}catch(n){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",n)}return console.warn("@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request"),await t()}})}zs();const Ks={url:ws,storageKey:ys,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:bs,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1},se=30*1e3,We=3;async function Ye(i,e,t){return await t()}class ae{constructor(e){var t,s;this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log,this.instanceID=ae.nextInstanceID,ae.nextInstanceID+=1,this.instanceID>0&&O()&&console.warn("Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.");const r=Object.assign(Object.assign({},Ks),e);if(this.logDebugMessages=!!r.debug,typeof r.debug=="function"&&(this.logger=r.debug),this.persistSession=r.persistSession,this.storageKey=r.storageKey,this.autoRefreshToken=r.autoRefreshToken,this.admin=new Vs({url:r.url,headers:r.headers,fetch:r.fetch}),this.url=r.url,this.headers=r.headers,this.fetch=ot(r.fetch),this.lock=r.lock||Ye,this.detectSessionInUrl=r.detectSessionInUrl,this.flowType=r.flowType,this.hasCustomAuthorizationHeader=r.hasCustomAuthorizationHeader,r.lock?this.lock=r.lock:O()&&!((t=globalThis==null?void 0:globalThis.navigator)===null||t===void 0)&&t.locks?this.lock=Zs:this.lock=Ye,this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this)},this.persistSession?r.storage?this.storage=r.storage:ne()?this.storage=Gs:(this.memoryStorage={},this.storage=Ke(this.memoryStorage)):(this.memoryStorage={},this.storage=Ke(this.memoryStorage)),O()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(n){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",n)}(s=this.broadcastChannel)===null||s===void 0||s.addEventListener("message",async n=>{this._debug("received broadcast notification from other tab or client",n),await this._notifyAllSubscribers(n.data.event,n.data.session,!1)})}this.initialize()}_debug(...e){return this.logDebugMessages&&this.logger(`GoTrueClient@${this.instanceID} (${it}) ${new Date().toISOString()}`,...e),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(-1,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){try{const e=O()?await this._isPKCEFlow():!1;if(this._debug("#_initialize()","begin","is PKCE flow",e),e||this.detectSessionInUrl&&this._isImplicitGrantFlow()){const{data:t,error:s}=await this._getSessionFromURL(e);if(s)return this._debug("#_initialize()","error detecting session from URL",s),(s==null?void 0:s.message)==="Identity is already linked"||(s==null?void 0:s.message)==="Identity is already linked to another user"?{error:s}:(await this._removeSession(),{error:s});const{session:r,redirectType:n}=t;return this._debug("#_initialize()","detected session in URL",r,"redirect type",n),await this._saveSession(r),setTimeout(async()=>{n==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",r):await this._notifyAllSubscribers("SIGNED_IN",r)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(e){return b(e)?{error:e}:{error:new lt("Unexpected error during initialization",e)}}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var t,s,r;try{await this._removeSession();const n=await v(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(s=(t=e==null?void 0:e.options)===null||t===void 0?void 0:t.data)!==null&&s!==void 0?s:{},gotrue_meta_security:{captcha_token:(r=e==null?void 0:e.options)===null||r===void 0?void 0:r.captchaToken}},xform:N}),{data:o,error:l}=n;if(l||!o)return{data:{user:null,session:null},error:l};const c=o.session,d=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",c)),{data:{user:d,session:c},error:null}}catch(n){if(b(n))return{data:{user:null,session:null},error:n};throw n}}async signUp(e){var t,s,r;try{await this._removeSession();let n;if("email"in e){const{email:u,password:h,options:g}=e;let w=null,y=null;this.flowType==="pkce"&&([w,y]=await W(this.storage,this.storageKey)),n=await v(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:g==null?void 0:g.emailRedirectTo,body:{email:u,password:h,data:(t=g==null?void 0:g.data)!==null&&t!==void 0?t:{},gotrue_meta_security:{captcha_token:g==null?void 0:g.captchaToken},code_challenge:w,code_challenge_method:y},xform:N})}else if("phone"in e){const{phone:u,password:h,options:g}=e;n=await v(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:u,password:h,data:(s=g==null?void 0:g.data)!==null&&s!==void 0?s:{},channel:(r=g==null?void 0:g.channel)!==null&&r!==void 0?r:"sms",gotrue_meta_security:{captcha_token:g==null?void 0:g.captchaToken}},xform:N})}else throw new ue("You must provide either an email or phone number and a password");const{data:o,error:l}=n;if(l||!o)return{data:{user:null,session:null},error:l};const c=o.session,d=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",c)),{data:{user:d,session:c},error:null}}catch(n){if(b(n))return{data:{user:null,session:null},error:n};throw n}}async signInWithPassword(e){try{await this._removeSession();let t;if("email"in e){const{email:n,password:o,options:l}=e;t=await v(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:n,password:o,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken}},xform:Ze})}else if("phone"in e){const{phone:n,password:o,options:l}=e;t=await v(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:n,password:o,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken}},xform:Ze})}else throw new ue("You must provide either an email or phone number and a password");const{data:s,error:r}=t;return r?{data:{user:null,session:null},error:r}:!s||!s.session||!s.user?{data:{user:null,session:null},error:new be}:(s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers("SIGNED_IN",s.session)),{data:Object.assign({user:s.user,session:s.session},s.weak_password?{weakPassword:s.weak_password}:null),error:r})}catch(t){if(b(t))return{data:{user:null,session:null},error:t};throw t}}async signInWithOAuth(e){var t,s,r,n;return await this._removeSession(),await this._handleProviderSignIn(e.provider,{redirectTo:(t=e.options)===null||t===void 0?void 0:t.redirectTo,scopes:(s=e.options)===null||s===void 0?void 0:s.scopes,queryParams:(r=e.options)===null||r===void 0?void 0:r.queryParams,skipBrowserRedirect:(n=e.options)===null||n===void 0?void 0:n.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(-1,async()=>this._exchangeCodeForSession(e))}async _exchangeCodeForSession(e){const t=await ce(this.storage,`${this.storageKey}-code-verifier`),[s,r]=(t??"").split("/"),{data:n,error:o}=await v(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:s},xform:N});return await ye(this.storage,`${this.storageKey}-code-verifier`),o?{data:{user:null,session:null,redirectType:null},error:o}:!n||!n.session||!n.user?{data:{user:null,session:null,redirectType:null},error:new be}:(n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers("SIGNED_IN",n.session)),{data:Object.assign(Object.assign({},n),{redirectType:r??null}),error:o})}async signInWithIdToken(e){await this._removeSession();try{const{options:t,provider:s,token:r,access_token:n,nonce:o}=e,l=await v(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:s,id_token:r,access_token:n,nonce:o,gotrue_meta_security:{captcha_token:t==null?void 0:t.captchaToken}},xform:N}),{data:c,error:d}=l;return d?{data:{user:null,session:null},error:d}:!c||!c.session||!c.user?{data:{user:null,session:null},error:new be}:(c.session&&(await this._saveSession(c.session),await this._notifyAllSubscribers("SIGNED_IN",c.session)),{data:c,error:d})}catch(t){if(b(t))return{data:{user:null,session:null},error:t};throw t}}async signInWithOtp(e){var t,s,r,n,o;try{if(await this._removeSession(),"email"in e){const{email:l,options:c}=e;let d=null,u=null;this.flowType==="pkce"&&([d,u]=await W(this.storage,this.storageKey));const{error:h}=await v(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:l,data:(t=c==null?void 0:c.data)!==null&&t!==void 0?t:{},create_user:(s=c==null?void 0:c.shouldCreateUser)!==null&&s!==void 0?s:!0,gotrue_meta_security:{captcha_token:c==null?void 0:c.captchaToken},code_challenge:d,code_challenge_method:u},redirectTo:c==null?void 0:c.emailRedirectTo});return{data:{user:null,session:null},error:h}}if("phone"in e){const{phone:l,options:c}=e,{data:d,error:u}=await v(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:l,data:(r=c==null?void 0:c.data)!==null&&r!==void 0?r:{},create_user:(n=c==null?void 0:c.shouldCreateUser)!==null&&n!==void 0?n:!0,gotrue_meta_security:{captcha_token:c==null?void 0:c.captchaToken},channel:(o=c==null?void 0:c.channel)!==null&&o!==void 0?o:"sms"}});return{data:{user:null,session:null,messageId:d==null?void 0:d.message_id},error:u}}throw new ue("You must provide either an email or phone number.")}catch(l){if(b(l))return{data:{user:null,session:null},error:l};throw l}}async verifyOtp(e){var t,s;try{e.type!=="email_change"&&e.type!=="phone_change"&&await this._removeSession();let r,n;"options"in e&&(r=(t=e.options)===null||t===void 0?void 0:t.redirectTo,n=(s=e.options)===null||s===void 0?void 0:s.captchaToken);const{data:o,error:l}=await v(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:n}}),redirectTo:r,xform:N});if(l)throw l;if(!o)throw new Error("An error occurred on token verification.");const c=o.session,d=o.user;return c!=null&&c.access_token&&(await this._saveSession(c),await this._notifyAllSubscribers(e.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",c)),{data:{user:d,session:c},error:null}}catch(r){if(b(r))return{data:{user:null,session:null},error:r};throw r}}async signInWithSSO(e){var t,s,r;try{await this._removeSession();let n=null,o=null;return this.flowType==="pkce"&&([n,o]=await W(this.storage,this.storageKey)),await v(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in e?{provider_id:e.providerId}:null),"domain"in e?{domain:e.domain}:null),{redirect_to:(s=(t=e.options)===null||t===void 0?void 0:t.redirectTo)!==null&&s!==void 0?s:void 0}),!((r=e==null?void 0:e.options)===null||r===void 0)&&r.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:n,code_challenge_method:o}),headers:this.headers,xform:Bs})}catch(n){if(b(n))return{data:null,error:n};throw n}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async e=>{const{data:{session:t},error:s}=e;if(s)throw s;if(!t)throw new G;const{error:r}=await v(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:t.access_token});return{data:{user:null,session:null},error:r}})}catch(e){if(b(e))return{data:{user:null,session:null},error:e};throw e}}async resend(e){try{e.type!="email_change"&&e.type!="phone_change"&&await this._removeSession();const t=`${this.url}/resend`;if("email"in e){const{email:s,type:r,options:n}=e,{error:o}=await v(this.fetch,"POST",t,{headers:this.headers,body:{email:s,type:r,gotrue_meta_security:{captcha_token:n==null?void 0:n.captchaToken}},redirectTo:n==null?void 0:n.emailRedirectTo});return{data:{user:null,session:null},error:o}}else if("phone"in e){const{phone:s,type:r,options:n}=e,{data:o,error:l}=await v(this.fetch,"POST",t,{headers:this.headers,body:{phone:s,type:r,gotrue_meta_security:{captcha_token:n==null?void 0:n.captchaToken}}});return{data:{user:null,session:null,messageId:o==null?void 0:o.message_id},error:l}}throw new ue("You must provide either an email or phone number and a type")}catch(t){if(b(t))return{data:{user:null,session:null},error:t};throw t}}async getSession(){return await this.initializePromise,await this._acquireLock(-1,async()=>this._useSession(async e=>e))}async _acquireLock(e,t){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){const s=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),r=(async()=>(await s,await t()))();return this.pendingInLock.push((async()=>{try{await r}catch{}})()),r}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const s=t();for(this.pendingInLock.push((async()=>{try{await s}catch{}})()),await s;this.pendingInLock.length;){const r=[...this.pendingInLock];await Promise.all(r),this.pendingInLock.splice(0,r.length)}return await s}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(e){this._debug("#_useSession","begin");try{const t=await this.__loadSession();return await e(t)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let e=null;const t=await ce(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",t),t!==null&&(this._isValidSession(t)?e=t:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!e)return{data:{session:null},error:null};const s=e.expires_at?e.expires_at<=Date.now()/1e3:!1;if(this._debug("#__loadSession()",`session has${s?"":" not"} expired`,"expires_at",e.expires_at),!s){if(this.storage.isServer){const o=this.suppressGetSessionWarning;e=new Proxy(e,{get(l,c,d){return!o&&c==="user"&&console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and many not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),Reflect.get(l,c,d)}})}return{data:{session:e},error:null}}const{session:r,error:n}=await this._callRefreshToken(e.refresh_token);return n?{data:{session:null},error:n}:{data:{session:r},error:null}}finally{this._debug("#__loadSession()","end")}}async getUser(e){return e?await this._getUser(e):(await this.initializePromise,await this._acquireLock(-1,async()=>await this._getUser()))}async _getUser(e){try{return e?await v(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:H}):await this._useSession(async t=>{var s,r,n;const{data:o,error:l}=t;if(l)throw l;return!(!((s=o.session)===null||s===void 0)&&s.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new G}:await v(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(n=(r=o.session)===null||r===void 0?void 0:r.access_token)!==null&&n!==void 0?n:void 0,xform:H})})}catch(t){if(b(t))return{data:{user:null},error:t};throw t}}async updateUser(e,t={}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._updateUser(e,t))}async _updateUser(e,t={}){try{return await this._useSession(async s=>{const{data:r,error:n}=s;if(n)throw n;if(!r.session)throw new G;const o=r.session;let l=null,c=null;this.flowType==="pkce"&&e.email!=null&&([l,c]=await W(this.storage,this.storageKey));const{data:d,error:u}=await v(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:t==null?void 0:t.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:l,code_challenge_method:c}),jwt:o.access_token,xform:H});if(u)throw u;return o.user=d.user,await this._saveSession(o),await this._notifyAllSubscribers("USER_UPDATED",o),{data:{user:o.user},error:null}})}catch(s){if(b(s))return{data:{user:null},error:s};throw s}}_decodeJWT(e){return Ve(e)}async setSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._setSession(e))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new G;const t=Date.now()/1e3;let s=t,r=!0,n=null;const o=Ve(e.access_token);if(o.exp&&(s=o.exp,r=s<=t),r){const{session:l,error:c}=await this._callRefreshToken(e.refresh_token);if(c)return{data:{user:null,session:null},error:c};if(!l)return{data:{user:null,session:null},error:null};n=l}else{const{data:l,error:c}=await this._getUser(e.access_token);if(c)throw c;n={access_token:e.access_token,refresh_token:e.refresh_token,user:l.user,token_type:"bearer",expires_in:s-t,expires_at:s},await this._saveSession(n),await this._notifyAllSubscribers("SIGNED_IN",n)}return{data:{user:n.user,session:n},error:null}}catch(t){if(b(t))return{data:{session:null,user:null},error:t};throw t}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async t=>{var s;if(!e){const{data:o,error:l}=t;if(l)throw l;e=(s=o.session)!==null&&s!==void 0?s:void 0}if(!(e!=null&&e.refresh_token))throw new G;const{session:r,error:n}=await this._callRefreshToken(e.refresh_token);return n?{data:{user:null,session:null},error:n}:r?{data:{user:r.user,session:r},error:null}:{data:{user:null,session:null},error:null}})}catch(t){if(b(t))return{data:{user:null,session:null},error:t};throw t}}async _getSessionFromURL(e){try{if(!O())throw new de("No browser detected.");if(this.flowType==="implicit"&&!this._isImplicitGrantFlow())throw new de("Not a valid implicit grant flow url.");if(this.flowType=="pkce"&&!e)throw new Ge("Not a valid PKCE flow url.");const t=we(window.location.href);if(e){if(!t.code)throw new Ge("No code detected.");const{data:D,error:U}=await this._exchangeCodeForSession(t.code);if(U)throw U;const j=new URL(window.location.href);return j.searchParams.delete("code"),window.history.replaceState(window.history.state,"",j.toString()),{data:{session:D.session,redirectType:null},error:null}}if(t.error||t.error_description||t.error_code)throw new de(t.error_description||"Error in URL with unspecified error_description",{error:t.error||"unspecified_error",code:t.error_code||"unspecified_code"});const{provider_token:s,provider_refresh_token:r,access_token:n,refresh_token:o,expires_in:l,expires_at:c,token_type:d}=t;if(!n||!l||!o||!d)throw new de("No session defined in URL");const u=Math.round(Date.now()/1e3),h=parseInt(l);let g=u+h;c&&(g=parseInt(c));const w=g-u;w*1e3<=se&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${w}s, should have been closer to ${h}s`);const y=g-h;u-y>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",y,g,u):u-y<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clok for skew",y,g,u);const{data:x,error:C}=await this._getUser(n);if(C)throw C;const B={provider_token:s,provider_refresh_token:r,access_token:n,expires_in:h,expires_at:g,refresh_token:o,token_type:d,user:x.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),{data:{session:B,redirectType:t.type},error:null}}catch(t){if(b(t))return{data:{session:null,redirectType:null},error:t};throw t}}_isImplicitGrantFlow(){const e=we(window.location.href);return!!(O()&&(e.access_token||e.error_description))}async _isPKCEFlow(){const e=we(window.location.href),t=await ce(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&t)}async signOut(e={scope:"global"}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._signOut(e))}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async t=>{var s;const{data:r,error:n}=t;if(n)return{error:n};const o=(s=r.session)===null||s===void 0?void 0:s.access_token;if(o){const{error:l}=await this.admin.signOut(o,e);if(l&&!(Ls(l)&&(l.status===404||l.status===401||l.status===403)))return{error:l}}return e!=="others"&&(await this._removeSession(),await ye(this.storage,`${this.storageKey}-code-verifier`),await this._notifyAllSubscribers("SIGNED_OUT",null)),{error:null}})}onAuthStateChange(e){const t=_s(),s={id:t,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",t),this.stateChangeEmitters.delete(t)}};return this._debug("#onAuthStateChange()","registered callback with id",t),this.stateChangeEmitters.set(t,s),(async()=>(await this.initializePromise,await this._acquireLock(-1,async()=>{this._emitInitialSession(t)})))(),{data:{subscription:s}}}async _emitInitialSession(e){return await this._useSession(async t=>{var s,r;try{const{data:{session:n},error:o}=t;if(o)throw o;await((s=this.stateChangeEmitters.get(e))===null||s===void 0?void 0:s.callback("INITIAL_SESSION",n)),this._debug("INITIAL_SESSION","callback id",e,"session",n)}catch(n){await((r=this.stateChangeEmitters.get(e))===null||r===void 0?void 0:r.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",n),console.error(n)}})}async resetPasswordForEmail(e,t={}){let s=null,r=null;this.flowType==="pkce"&&([s,r]=await W(this.storage,this.storageKey,!0));try{return await v(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:s,code_challenge_method:r,gotrue_meta_security:{captcha_token:t.captchaToken}},headers:this.headers,redirectTo:t.redirectTo})}catch(n){if(b(n))return{data:null,error:n};throw n}}async getUserIdentities(){var e;try{const{data:t,error:s}=await this.getUser();if(s)throw s;return{data:{identities:(e=t.user.identities)!==null&&e!==void 0?e:[]},error:null}}catch(t){if(b(t))return{data:null,error:t};throw t}}async linkIdentity(e){var t;try{const{data:s,error:r}=await this._useSession(async n=>{var o,l,c,d,u;const{data:h,error:g}=n;if(g)throw g;const w=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:(o=e.options)===null||o===void 0?void 0:o.redirectTo,scopes:(l=e.options)===null||l===void 0?void 0:l.scopes,queryParams:(c=e.options)===null||c===void 0?void 0:c.queryParams,skipBrowserRedirect:!0});return await v(this.fetch,"GET",w,{headers:this.headers,jwt:(u=(d=h.session)===null||d===void 0?void 0:d.access_token)!==null&&u!==void 0?u:void 0})});if(r)throw r;return O()&&!(!((t=e.options)===null||t===void 0)&&t.skipBrowserRedirect)&&window.location.assign(s==null?void 0:s.url),{data:{provider:e.provider,url:s==null?void 0:s.url},error:null}}catch(s){if(b(s))return{data:{provider:e.provider,url:null},error:s};throw s}}async unlinkIdentity(e){try{return await this._useSession(async t=>{var s,r;const{data:n,error:o}=t;if(o)throw o;return await v(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:(r=(s=n.session)===null||s===void 0?void 0:s.access_token)!==null&&r!==void 0?r:void 0})})}catch(t){if(b(t))return{data:null,error:t};throw t}}async _refreshAccessToken(e){const t=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(t,"begin");try{const s=Date.now();return await Ss(async r=>(r>0&&await Cs(200*Math.pow(2,r-1)),this._debug(t,"refreshing attempt",r),await v(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:N})),(r,n)=>{const o=200*Math.pow(2,r);return n&&ve(n)&&Date.now()+o-s{try{await l.callback(e,t)}catch(c){n.push(c)}});if(await Promise.all(o),n.length>0){for(let l=0;lthis._autoRefreshTokenTick(),se);this.autoRefreshTicker=e,e&&typeof e=="object"&&typeof e.unref=="function"?e.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(e),setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{const e=Date.now();try{return await this._useSession(async t=>{const{data:{session:s}}=t;if(!s||!s.refresh_token||!s.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const r=Math.floor((s.expires_at*1e3-e)/se);this._debug("#_autoRefreshTokenTick()",`access token expires in ${r} ticks, a tick lasts ${se}ms, refresh threshold is ${We} ticks`),r<=We&&await this._callRefreshToken(s.refresh_token)})}catch(t){console.error("Auto refresh tick failed with error. This is likely a transient error.",t)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(e){if(e.isAcquireTimeout||e instanceof ct)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!O()||!(window!=null&&window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>await this._onVisibilityChanged(!1),window==null||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){const t=`#_onVisibilityChanged(${e})`;this._debug(t,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),e||(await this.initializePromise,await this._acquireLock(-1,async()=>{if(document.visibilityState!=="visible"){this._debug(t,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()}))):document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,t,s){const r=[`provider=${encodeURIComponent(t)}`];if(s!=null&&s.redirectTo&&r.push(`redirect_to=${encodeURIComponent(s.redirectTo)}`),s!=null&&s.scopes&&r.push(`scopes=${encodeURIComponent(s.scopes)}`),this.flowType==="pkce"){const[n,o]=await W(this.storage,this.storageKey),l=new URLSearchParams({code_challenge:`${encodeURIComponent(n)}`,code_challenge_method:`${encodeURIComponent(o)}`});r.push(l.toString())}if(s!=null&&s.queryParams){const n=new URLSearchParams(s.queryParams);r.push(n.toString())}return s!=null&&s.skipBrowserRedirect&&r.push(`skip_http_redirect=${s.skipBrowserRedirect}`),`${e}?${r.join("&")}`}async _unenroll(e){try{return await this._useSession(async t=>{var s;const{data:r,error:n}=t;return n?{data:null,error:n}:await v(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(s=r==null?void 0:r.session)===null||s===void 0?void 0:s.access_token})})}catch(t){if(b(t))return{data:null,error:t};throw t}}async _enroll(e){try{return await this._useSession(async t=>{var s,r;const{data:n,error:o}=t;if(o)return{data:null,error:o};const{data:l,error:c}=await v(this.fetch,"POST",`${this.url}/factors`,{body:{friendly_name:e.friendlyName,factor_type:e.factorType,issuer:e.issuer},headers:this.headers,jwt:(s=n==null?void 0:n.session)===null||s===void 0?void 0:s.access_token});return c?{data:null,error:c}:(!((r=l==null?void 0:l.totp)===null||r===void 0)&&r.qr_code&&(l.totp.qr_code=`data:image/svg+xml;utf-8,${l.totp.qr_code}`),{data:l,error:null})})}catch(t){if(b(t))return{data:null,error:t};throw t}}async _verify(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async t=>{var s;const{data:r,error:n}=t;if(n)return{data:null,error:n};const{data:o,error:l}=await v(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:{code:e.code,challenge_id:e.challengeId},headers:this.headers,jwt:(s=r==null?void 0:r.session)===null||s===void 0?void 0:s.access_token});return l?{data:null,error:l}:(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+o.expires_in},o)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",o),{data:o,error:l})})}catch(t){if(b(t))return{data:null,error:t};throw t}})}async _challenge(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async t=>{var s;const{data:r,error:n}=t;return n?{data:null,error:n}:await v(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{headers:this.headers,jwt:(s=r==null?void 0:r.session)===null||s===void 0?void 0:s.access_token})})}catch(t){if(b(t))return{data:null,error:t};throw t}})}async _challengeAndVerify(e){const{data:t,error:s}=await this._challenge({factorId:e.factorId});return s?{data:null,error:s}:await this._verify({factorId:e.factorId,challengeId:t.id,code:e.code})}async _listFactors(){const{data:{user:e},error:t}=await this.getUser();if(t)return{data:null,error:t};const s=(e==null?void 0:e.factors)||[],r=s.filter(n=>n.factor_type==="totp"&&n.status==="verified");return{data:{all:s,totp:r},error:null}}async _getAuthenticatorAssuranceLevel(){return this._acquireLock(-1,async()=>await this._useSession(async e=>{var t,s;const{data:{session:r},error:n}=e;if(n)return{data:null,error:n};if(!r)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const o=this._decodeJWT(r.access_token);let l=null;o.aal&&(l=o.aal);let c=l;((s=(t=r.user.factors)===null||t===void 0?void 0:t.filter(u=>u.status==="verified"))!==null&&s!==void 0?s:[]).length>0&&(c="aal2");const d=o.amr||[];return{data:{currentLevel:l,nextLevel:c,currentAuthenticationMethods:d},error:null}}))}}ae.nextInstanceID=0;const Ws=ae;class Ys extends Ws{constructor(e){super(e)}}var Xs=function(i,e,t,s){function r(n){return n instanceof t?n:new t(function(o){o(n)})}return new(t||(t=Promise))(function(n,o){function l(u){try{d(s.next(u))}catch(h){o(h)}}function c(u){try{d(s.throw(u))}catch(h){o(h)}}function d(u){u.done?n(u.value):r(u.value).then(l,c)}d((s=s.apply(i,[])).next())})};class Qs{constructor(e,t,s){var r,n,o;if(this.supabaseUrl=e,this.supabaseKey=t,!e)throw new Error("supabaseUrl is required.");if(!t)throw new Error("supabaseKey is required.");const l=gs(e);this.realtimeUrl=`${l}/realtime/v1`.replace(/^http/i,"ws"),this.authUrl=`${l}/auth/v1`,this.storageUrl=`${l}/storage/v1`,this.functionsUrl=`${l}/functions/v1`;const c=`sb-${new URL(this.authUrl).hostname.split(".")[0]}-auth-token`,d={db:ls,realtime:us,auth:Object.assign(Object.assign({},cs),{storageKey:c}),global:as},u=fs(s??{},d);this.storageKey=(r=u.auth.storageKey)!==null&&r!==void 0?r:"",this.headers=(n=u.global.headers)!==null&&n!==void 0?n:{},this.auth=this._initSupabaseAuthClient((o=u.auth)!==null&&o!==void 0?o:{},this.headers,u.global.fetch),this.fetch=ms(t,this._getAccessToken.bind(this),u.global.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers},u.realtime)),this.rest=new je(`${l}/rest/v1`,{headers:this.headers,schema:u.db.schema,fetch:this.fetch}),this._listenForAuthEvents()}get functions(){return new _t(this.functionsUrl,{headers:this.headers,customFetch:this.fetch})}get storage(){return new is(this.storageUrl,this.headers,this.fetch)}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,t={},s={}){return this.rest.rpc(e,t,s)}channel(e,t={config:{}}){return this.realtime.channel(e,t)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}_getAccessToken(){var e,t;return Xs(this,void 0,void 0,function*(){const{data:s}=yield this.auth.getSession();return(t=(e=s.session)===null||e===void 0?void 0:e.access_token)!==null&&t!==void 0?t:null})}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:s,storage:r,storageKey:n,flowType:o,debug:l},c,d){var u;const h={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new Ys({url:this.authUrl,headers:Object.assign(Object.assign({},h),c),storageKey:n,autoRefreshToken:e,persistSession:t,detectSessionInUrl:s,storage:r,flowType:o,debug:l,fetch:d,hasCustomAuthorizationHeader:(u="Authorization"in this.headers)!==null&&u!==void 0?u:!1})}_initRealtimeClient(e){return new Gt(this.realtimeUrl,Object.assign(Object.assign({},e),{params:Object.assign({apikey:this.supabaseKey},e==null?void 0:e.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((e,t)=>{this._handleTokenChanged(e,"CLIENT",t==null?void 0:t.access_token)})}_handleTokenChanged(e,t,s){(e==="TOKEN_REFRESHED"||e==="SIGNED_IN")&&this.changedAccessToken!==s?(this.realtime.setAuth(s??null),this.changedAccessToken=s):e==="SIGNED_OUT"&&(this.realtime.setAuth(this.supabaseKey),t=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}}const er=(i,e,t)=>new Qs(i,e,t),L=(i,e)=>{const t=i.__vccOpts||i;for(const[s,r]of e)t[s]=r;return t},tr={name:"SignIn",props:{translations:{type:Object,default:{}}},data(){return{isLoggingIn:!1,signInHasError:!1,signInError:"",email:"",password:"",showPassword:!1,errors:{email:"",password:""}}},mounted(){document.getElementById("signup-modal").classList.add("left-0")},methods:{async signIn(){this.isLoggingIn=!0,this.signInError="",this.signInHasError=!1;let i=await this.$parent.login(this.email,this.password);i.success?(this.email="",this.password="",this.$parent.removeGate(),document.body.classList.remove("overflow-hidden"),this.$parent.currentComponent="Account"):(this.signInError=i.error.message,this.signInHasError=!0,this.signInError==="Invalid login credentials"?(this.errors.email=this.translations.gdc_invalid_login_credentials,this.errors.password=this.translations.gdc_invalid_login_credentials):this.signInError==="Email not confirmed"&&(this.errors.email="",this.errors.password=this.translations.gdc_email_not_confirmed)),this.isLoggingIn=!1},async signInWithGoogle(){this.isLoggingIn=!0,this.signInError="",this.signInHasError=!1;let i=await this.$parent.loginOAuth("google");i.success?this.$parent.removeGate():(this.signInError=i.error.message,this.signInHasError=!0),this.isLoggingIn=!1},async register(){this.$parent.currentComponent="SignUp"},async forgotPassword(){this.$parent.currentComponent="ForgotPassword"},emailAndPasswordFilled(){return this.email.length>3&&this.password.length>3},togglePasswordVisibility(){this.showPassword=!this.showPassword}}},sr={class:"flex min-h-full justify-center flex-col md:flex-row"},rr={class:"md:max-w-[486px] md:w-full rounded-xl md:rounded-l-xl md:rounded-r-none md:rounded-none md:rounded-l-xl bg-center bg-no-repeat signup-background-image bg-cover md:min-h-[752px] md:h-auto text-white md:px-6"},ir={class:"px-8 py-2"},nr={class:"font-bold mb-[8px] hidden md:block"},or=["innerHTML"],ar={class:"sign-up-green-tick"},lr={class:"sign-up-green-tick"},cr={class:"sign-up-green-tick"},ur={class:"sign-up-green-tick"},dr={class:"sign-up-green-tick"},hr={class:"sign-up-green-tick"},pr={class:"sm:mx-auto sm:w-full pt-0 px-2 md:px-8 pb-5 xl:w-[644px]","data-freemium-form":"login"},mr={class:"bg-white sm:rounded-lg"},gr={class:"space-y-4",action:"#",method:"POST"},fr={class:"mt-3 md:mt-12"},wr={class:"text-sm text-gray-500 m-0"},yr={class:"text-lg font-semibold mt-3"},br={for:"email",class:"block text-[14px] leading-6 text-gray-900"},vr={class:"mt-2"},_r={class:"relative"},kr={key:0,class:"absolute inset-y-0 right-0 pr-3 flex items-center text-gray-400"},xr=a("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"},[a("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M18 10C18 14.4183 14.4183 18 10 18C5.58172 18 2 14.4183 2 10C2 5.58172 5.58172 2 10 2C14.4183 2 18 5.58172 18 10ZM10 5C10.4142 5 10.75 5.33579 10.75 5.75V10.25C10.75 10.6642 10.4142 11 10 11C9.58579 11 9.25 10.6642 9.25 10.25V5.75C9.25 5.33579 9.58579 5 10 5ZM10 15C10.5523 15 11 14.5523 11 14C11 13.4477 10.5523 13 10 13C9.44771 13 9 13.4477 9 14C9 14.5523 9.44771 15 10 15Z",fill:"#FF0000"})],-1),Cr=[xr],Sr={key:0,class:"text-red-500 text-[14px] mt-1"},Er={for:"password",class:"block text-[14px] leading-6 text-gray-900"},Tr={class:"mt-2 relative"},Pr=["type"],jr=["disabled"],Ir={key:0},$r=a("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"},[a("path",{d:"M10 12.5C11.3807 12.5 12.5 11.3807 12.5 10C12.5 8.61929 11.3807 7.5 10 7.5C8.61929 7.5 7.5 8.61929 7.5 10C7.5 11.3807 8.61929 12.5 10 12.5Z",fill:"#0F172A"}),a("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M0.664255 10.5904C0.517392 10.2087 0.517518 9.78563 0.66461 9.40408C2.10878 5.65788 5.7433 3 9.99859 3C14.256 3 17.892 5.66051 19.3347 9.40962C19.4816 9.79127 19.4814 10.2144 19.3344 10.5959C17.8902 14.3421 14.2557 17 10.0004 17C5.74298 17 2.10698 14.3395 0.664255 10.5904ZM14.0004 10C14.0004 12.2091 12.2095 14 10.0004 14C7.79123 14 6.00037 12.2091 6.00037 10C6.00037 7.79086 7.79123 6 10.0004 6C12.2095 6 14.0004 7.79086 14.0004 10Z",fill:"#0F172A"})],-1),Or=[$r],Ar={key:1},Lr=a("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"16",viewBox:"0 0 20 16",fill:"none"},[a("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M3.28033 0.21967C2.98744 -0.0732233 2.51256 -0.0732233 2.21967 0.21967C1.92678 0.512563 1.92678 0.987437 2.21967 1.28033L16.7197 15.7803C17.0126 16.0732 17.4874 16.0732 17.7803 15.7803C18.0732 15.4874 18.0732 15.0126 17.7803 14.7197L16.0352 12.9745C17.5064 11.8594 18.6595 10.3465 19.3344 8.59593C19.4814 8.21437 19.4816 7.79127 19.3347 7.40962C17.892 3.66051 14.256 1 9.99859 1C8.28207 1 6.66657 1.43249 5.2551 2.19444L3.28033 0.21967ZM7.75194 4.69128L8.84367 5.78301C9.18951 5.60223 9.58291 5.5 10.0002 5.5C11.3809 5.5 12.5002 6.61929 12.5002 8C12.5002 8.41727 12.398 8.81067 12.2172 9.15651L13.3091 10.2484C13.7454 9.60769 14.0004 8.83362 14.0004 8C14.0004 5.79086 12.2095 4 10.0004 4C9.16675 4 8.39268 4.25501 7.75194 4.69128Z",fill:"black"}),a("path",{d:"M10.7484 11.9302L13.2711 14.4529C12.2462 14.8074 11.1458 15 10.0004 15C5.74298 15 2.10698 12.3395 0.664255 8.59038C0.517392 8.20873 0.517518 7.78563 0.66461 7.40408C1.15603 6.12932 1.90108 4.98057 2.83791 4.01969L6.0702 7.25198C6.02436 7.4943 6.00037 7.74435 6.00037 8C6.00037 10.2091 7.79123 12 10.0004 12C10.256 12 10.5061 11.976 10.7484 11.9302Z",fill:"black"})],-1),Ur=[Lr],Rr={key:0,class:"text-red-500 text-[14px] mt-1"},Fr={class:"flex items-center justify-between"},Mr={class:"text-sm leading-6"},Br=["disabled"],Dr=a("svg",{"aria-hidden":"true",class:"w-6 h-6 animate-spin text-white fill-gray-700 mr-2",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[a("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),a("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})],-1),Nr=a("span",{class:"uppercase"},"Signing In",-1),qr=[Dr,Nr];function Hr(i,e,t,s,r,n){return m(),f("div",sr,[a("div",rr,[a("div",{class:E([t.translations.gdc_login_banner.split(" ").some(o=>o.length>=8)?"text-[100px]":"text-[120px]","hidden md:block font-bold leading-[140px] italic uppercase py-4 pl-9 pr-10 text-center"]),style:{"font-family":"'Anton', sans-serif"}},p(t.translations.gdc_login_banner),3),a("div",ir,[a("div",nr,p(t.translations.gdc_login_usp_header),1),a("div",{class:"font-bold mb-[8px] md:hidden",innerHTML:t.translations.gdc_login_usp_header_mobile},null,8,or),a("div",ar,p(t.translations.gdc_login_usp_1),1),a("div",lr,p(t.translations.gdc_login_usp_2),1),a("div",cr,p(t.translations.gdc_login_usp_3),1),a("div",ur,p(t.translations.gdc_login_usp_4),1),a("div",dr,p(t.translations.gdc_login_usp_5),1),a("div",hr,p(t.translations.gdc_login_usp_6),1)])]),a("div",pr,[a("div",mr,[a("form",gr,[a("div",fr,[a("p",wr,[oe(p(t.translations.gdc_not_member)+" ",1),a("button",{type:"button",onClick:e[0]||(e[0]=S(o=>n.register(),["stop","prevent"])),class:"leading-6 text-[#0157FF] hover:text-[#0157FF]","data-form-cta":"signup"},p(t.translations.gdc_click_to_register),1)]),a("h2",yr,p(t.translations.gdc_sign_in),1),a("label",br,p(t.translations.gdc_emailcapture_email_address),1),a("div",vr,[a("div",_r,[P(a("input",{"onUpdate:modelValue":e[1]||(e[1]=o=>r.email=o),id:"email",name:"email",type:"email",autocomplete:"email",required:"",class:E([r.errors.email?"border-red-500":"border-0","block w-full rounded-md py-2 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-[#0157FF] sm:text-sm sm:leading-6"])},null,2),[[M,r.email]]),r.errors.email?(m(),f("div",kr,Cr)):k("",!0)]),r.errors.email?(m(),f("p",Sr,p(r.errors.email),1)):k("",!0)])]),a("div",null,[a("label",Er,p(t.translations.gdc_password),1),a("div",Tr,[P(a("input",{"onUpdate:modelValue":e[2]||(e[2]=o=>r.password=o),id:"password",name:"password",type:r.showPassword?"text":"password",autocomplete:"current-password",required:"",class:E([r.errors.password?"border-red-500":"border-0","block w-full rounded-md py-2 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-[#0157FF] sm:text-sm sm:leading-6 pr-10"])},null,10,Pr),[[he,r.password]]),a("button",{type:"button",onClick:e[3]||(e[3]=S((...o)=>n.togglePasswordVisibility&&n.togglePasswordVisibility(...o),["stop","prevent"])),class:"absolute inset-y-0 right-0 pr-3 flex items-center text-gray-400",disabled:r.password.length==0},[r.showPassword?(m(),f("span",Ir,Or)):(m(),f("span",Ar,Ur))],8,jr)]),r.errors.password?(m(),f("p",Rr,p(r.errors.password),1)):k("",!0)]),a("div",Fr,[a("div",Mr,[a("span",{onClick:e[4]||(e[4]=S(o=>n.forgotPassword(),["stop","prevent"])),class:"text-[#0157FF] hover:text-[#0157FF] cursor-pointer"},p(t.translations.gdc_forgot_password),1)])]),a("div",null,[r.isLoggingIn?(m(),f("span",{key:1,onClick:e[6]||(e[6]=S(()=>{},["stop","prevent"])),class:"flex w-full justify-center rounded-md bg-[#FF0000] px-3 py-3 text-sm font-semibold leading-6 text-white shadow-sm focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[#0157FF]"},qr)):(m(),f("button",{key:0,onClick:e[5]||(e[5]=S(o=>n.signIn(),["stop","prevent"])),type:"submit",disabled:!n.emailAndPasswordFilled(),class:E([[n.emailAndPasswordFilled()?"bg-[#FF0000] hover:bg-[#E50000]":"bg-[#999999]"],"flex w-full justify-center rounded-md px-3 py-3 text-sm font-semibold leading-6 text-white shadow-sm focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[#0157FF] uppercase"]),"data-form-cta":"login"},p(t.translations.gdc_sign_in),11,Br))])])])])])}const Vr=L(tr,[["render",Hr]]),Gr={name:"SignUp",components:{},props:{background:{type:String,default:""},translations:{type:Object,default:{}}},data(){return{isSigningUp:!1,signUpHasError:!1,signUpError:"",name:"",email:"",password:"",phone_number:"",passwordConfirm:"",nickname:"",hiddenInput:"",acceptTerms:!1,acceptTerms2:!1,showPassword:!1,showPasswordConfirm:!1,errors:{name:"",nickname:"",email:"",password:"",passwordConfirm:"",acceptTerms:"",acceptTerms2:""}}},methods:{async signUp(){this.isSigningUp=!0,this.signUpHasError=!1,this.signUpError="",this.clearErrors();let i=document.getElementById("super_secret_username").value;if(this.hiddenInput!=""||i!=""){this.$parent.currentComponent="ConfirmEmail";return}this.name?this.name.length<=3?this.errors.name="Your name must be longer than 3 characters":this.name.length>30&&(this.errors.name="Your name must not be longer than 30 characters"):this.errors.name="Name is required",this.nickname&&this.nickname.length<=3?this.errors.nickname="Your nickname must be longer than 3 characters":this.nickname&&this.nickname.length>30&&(this.errors.nickname="Your nickname must not be longer than 30 characters");const e=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;this.email?e.test(this.email)||(this.errors.email=this.translations.gdc_enter_valid_email):this.errors.email="Email is required";const t=/^(?=.*[a-z])(?=.*[A-Z]).{8,16}$/;this.password?t.test(this.password)||(this.errors.password=this.translations.gdc_enter_valid_password):this.errors.password="Password is required",this.acceptTerms||(this.errors.acceptTerms="Please confirm that you are 18+"),this.acceptTerms2||(this.errors.acceptTerms2="Please confirm that you have read and agree to the privacy policy");const s=/^(07\d{9})$/;if(!this.phone_number&&this.$parent.currentUserGeo==="GB"&&(this.errors.phone_number="Phone no. is required"),this.phone_number&&!s.test(this.phone_number)&&(this.errors.phone_number="Phone no. must be in format 07xxxxxxxxx"),Object.values(this.errors).some(n=>n!=="")){this.isSigningUp=!1,this.signUpHasError=!0,this.signUpError="Please fix the highlighted errors";return}this.phone_number&&(this.phone_number=`44${this.phone_number.substring(1)}`);let r=await this.$parent.register(this.email,this.password,this.name,this.nickname,this.nickname!=""?this.nickname:this.name,this.acceptTerms,null,this.phone_number);r.success?this.$parent.currentComponent="ConfirmEmail":(this.signUpHasError=!0,this.errors.email=r.error.message),this.isSigningUp=!1},async signInWithGoogle(){this.isLoggingIn=!0,this.signInError="",this.signInHasError=!1;let i=await this.$parent.loginOAuth("google");i.success||(this.signInError=i.error.message,this.signInHasError=!0),this.isLoggingIn=!1},clearErrors(){this.errors.name="",this.errors.nickname="",this.errors.email="",this.errors.password="",this.errors.passwordConfirm="",this.errors.acceptTerms="",this.errors.phone_number=""},allFieldsFilled(){return this.$parent.currentUserGeo==="GB"?this.email.length>3&&this.password.length>3&&this.name.length>0&&this.acceptTerms&&this.acceptTerms2&&this.phone_number:this.email.length>3&&this.password.length>3&&this.name.length>0&&this.acceptTerms&&this.acceptTerms2},async signIn(){this.$parent.currentComponent="SignIn"},togglePasswordVisibility(){this.showPassword=!this.showPassword},togglePasswordConfirmVisibility(){this.showPasswordConfirm=!this.showPasswordConfirm}},mounted(){document.getElementById("signup-modal").classList.add("left-0")}},zr={class:"flex min-h-full justify-center flex-col md:flex-row"},Jr={class:"md:max-w-[486px] md:w-full rounded-xl md:rounded-l-xl md:rounded-r-none md:rounded-none md:rounded-l-xl bg-center bg-no-repeat signup-background-image bg-cover md:min-h-[752px] md:h-auto text-white md:px-6"},Zr={class:"px-8 py-2"},Kr={class:"font-bold mb-[8px] hidden md:block"},Wr=["innerHTML"],Yr={class:"sign-up-green-tick"},Xr={class:"sign-up-green-tick"},Qr={class:"sign-up-green-tick"},ei={class:"sign-up-green-tick"},ti={class:"sign-up-green-tick"},si={class:"sign-up-green-tick"},ri={class:"sm:mx-auto sm:w-full pt-0 px-2 md:px-8 pb-5 xl:w-[644px]","data-freemium-form":"signup"},ii={class:"bg-white sm:rounded-lg"},ni={class:"space-y-4",action:"#",method:"POST"},oi={class:"mt-3 md:mt-12"},ai={class:"text-sm text-gray-500 m-0"},li=["innerHTML"],ci={class:"text-xs"},ui={for:"signup-name",class:"block text-[14px] leading-6 text-gray-900"},di={class:"mt-2"},hi={key:0,class:"text-red-500 text-[14px] mt-1"},pi={for:"signup-nickname",class:"block text-[14px] leading-6 text-gray-900"},mi={class:"mt-2"},gi={key:0,class:"text-red-500 text-[14px] mt-1"},fi={key:0},wi={for:"email",class:"block text-[14px] leading-6 text-gray-900"},yi={class:"mt-2"},bi={key:0,class:"text-red-500 text-[14px] mt-1"},vi={for:"email",class:"block text-[14px] leading-6 text-gray-900"},_i={class:"mt-2"},ki={key:0,class:"text-red-500 text-[14px] mt-1"},xi={for:"password",class:"flex items-center text-[14px] leading-6 text-gray-900"},Ci={class:"group inline-block relative ml-1"},Si=a("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 14 14",fill:"none"},[a("path",{d:"M6.5 6.5L6.52766 6.48617C6.90974 6.29513 7.33994 6.64023 7.23634 7.05465L6.76366 8.94535C6.66006 9.35977 7.09026 9.70487 7.47234 9.51383L7.5 9.5M13 7C13 10.3137 10.3137 13 7 13C3.68629 13 1 10.3137 1 7C1 3.68629 3.68629 1 7 1C10.3137 1 13 3.68629 13 7ZM7 4.5H7.005V4.505H7V4.5Z",stroke:"#0157FF","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"})],-1),Ei={class:"text-[14px] w-[200px] bg-gdc-gray-100 text-black p-[5px] rounded-md invisible absolute left-[15px] z-[1] group-hover:visible"},Ti={class:"mt-2"},Pi={class:"relative"},ji=["type"],Ii=["disabled"],$i={key:0},Oi=a("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"},[a("path",{d:"M10 12.5C11.3807 12.5 12.5 11.3807 12.5 10C12.5 8.61929 11.3807 7.5 10 7.5C8.61929 7.5 7.5 8.61929 7.5 10C7.5 11.3807 8.61929 12.5 10 12.5Z",fill:"#0F172A"}),a("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M0.664255 10.5904C0.517392 10.2087 0.517518 9.78563 0.66461 9.40408C2.10878 5.65788 5.7433 3 9.99859 3C14.256 3 17.892 5.66051 19.3347 9.40962C19.4816 9.79127 19.4814 10.2144 19.3344 10.5959C17.8902 14.3421 14.2557 17 10.0004 17C5.74298 17 2.10698 14.3395 0.664255 10.5904ZM14.0004 10C14.0004 12.2091 12.2095 14 10.0004 14C7.79123 14 6.00037 12.2091 6.00037 10C6.00037 7.79086 7.79123 6 10.0004 6C12.2095 6 14.0004 7.79086 14.0004 10Z",fill:"#0F172A"})],-1),Ai=[Oi],Li={key:1},Ui=a("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"16",viewBox:"0 0 20 16",fill:"none"},[a("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M3.28033 0.21967C2.98744 -0.0732233 2.51256 -0.0732233 2.21967 0.21967C1.92678 0.512563 1.92678 0.987437 2.21967 1.28033L16.7197 15.7803C17.0126 16.0732 17.4874 16.0732 17.7803 15.7803C18.0732 15.4874 18.0732 15.0126 17.7803 14.7197L16.0352 12.9745C17.5064 11.8594 18.6595 10.3465 19.3344 8.59593C19.4814 8.21437 19.4816 7.79127 19.3347 7.40962C17.892 3.66051 14.256 1 9.99859 1C8.28207 1 6.66657 1.43249 5.2551 2.19444L3.28033 0.21967ZM7.75194 4.69128L8.84367 5.78301C9.18951 5.60223 9.58291 5.5 10.0002 5.5C11.3809 5.5 12.5002 6.61929 12.5002 8C12.5002 8.41727 12.398 8.81067 12.2172 9.15651L13.3091 10.2484C13.7454 9.60769 14.0004 8.83362 14.0004 8C14.0004 5.79086 12.2095 4 10.0004 4C9.16675 4 8.39268 4.25501 7.75194 4.69128Z",fill:"black"}),a("path",{d:"M10.7484 11.9302L13.2711 14.4529C12.2462 14.8074 11.1458 15 10.0004 15C5.74298 15 2.10698 12.3395 0.664255 8.59038C0.517392 8.20873 0.517518 7.78563 0.66461 7.40408C1.15603 6.12932 1.90108 4.98057 2.83791 4.01969L6.0702 7.25198C6.02436 7.4943 6.00037 7.74435 6.00037 8C6.00037 10.2091 7.79123 12 10.0004 12C10.256 12 10.5061 11.976 10.7484 11.9302Z",fill:"black"})],-1),Ri=[Ui],Fi={key:0,class:"text-red-500 text-[14px] mt-1"},Mi={class:"relative flex items-start"},Bi={class:"flex h-6 items-center"},Di={class:"ml-3 text-sm leading-6"},Ni=["innerHTML"],qi={class:"relative flex items-start mt-3"},Hi={class:"flex h-6 items-center"},Vi={class:"ml-3 text-sm leading-6"},Gi=["innerHTML"],zi=["disabled"],Ji=a("svg",{"aria-hidden":"true",class:"w-6 h-6 animate-spin text-white fill-gray-700 mr-2",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[a("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),a("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})],-1),Zi=a("span",null,"SIGNING UP",-1),Ki=[Ji,Zi];function Wi(i,e,t,s,r,n){return m(),f("div",zr,[a("div",Jr,[a("div",{class:E([t.translations.gdc_login_banner.split(" ").some(o=>o.length>=8)?"text-[100px]":"text-[120px]","hidden md:block font-bold leading-[140px] italic uppercase py-4 pl-9 pr-10 text-center"]),style:{"font-family":"'Anton', sans-serif"}},p(t.translations.gdc_login_banner),3),a("div",Zr,[a("div",Kr,p(t.translations.gdc_login_usp_header),1),a("div",{class:"font-bold mb-[8px] md:hidden",innerHTML:t.translations.gdc_login_usp_header_mobile},null,8,Wr),a("div",Yr,p(t.translations.gdc_login_usp_1),1),a("div",Xr,p(t.translations.gdc_login_usp_2),1),a("div",Qr,p(t.translations.gdc_login_usp_3),1),a("div",ei,p(t.translations.gdc_login_usp_4),1),a("div",ti,p(t.translations.gdc_login_usp_5),1),a("div",si,p(t.translations.gdc_login_usp_6),1)])]),a("div",ri,[a("div",ii,[a("form",ni,[a("div",oi,[a("p",ai,[oe(p(t.translations.gdc_already_member)+" ",1),a("button",{type:"button",onClick:e[0]||(e[0]=S(o=>n.signIn(),["stop","prevent"])),class:"leading-6 text-[#0157FF] hover:text-[#0157FF]","data-form-cta":"login"},p(t.translations.gdc_click_here_to_sign_in),1)]),a("span",{class:"text-lg font-semibold mt-3 mb-1 inline-block",innerHTML:t.translations.gdc_create_a_free_account},null,8,li),a("p",ci,p(t.translations.gdc_login_required_fields),1),a("label",ui,p(t.translations.gdc_name)+" *",1),a("div",di,[P(a("input",{"onUpdate:modelValue":e[1]||(e[1]=o=>r.name=o),id:"signup-name",name:"signup-name",type:"text",autocomplete:"given-name",required:"",placeholder:"John",class:E([r.errors.name?"border-red-500 signUpErrorIcon":"border-0","block w-full rounded-md py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-[#0157FF] sm:text-sm sm:leading-6"])},null,2),[[M,r.name]]),r.errors.name?(m(),f("p",hi,p(r.errors.name),1)):k("",!0)])]),a("div",null,[a("label",pi,p(t.translations.gdc_nickname)+" ("+p(t.translations.gdc_optional)+")",1),a("div",mi,[P(a("input",{"onUpdate:modelValue":e[2]||(e[2]=o=>r.nickname=o),id:"signup-nickname",name:"signup-nickname",type:"text",placeholder:"HighRoller",class:"block w-full rounded-md py-1.5 text-gray-900 shadow-sm border-0 ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-[#0157FF] sm:text-sm sm:leading-6"},null,512),[[M,r.nickname]]),r.errors.nickname?(m(),f("p",gi,p(r.errors.nickname),1)):k("",!0)])]),this.$parent.currentUserGeo==="GB"?(m(),f("div",fi,[a("label",wi,p(t.translations.phone_number)+" *",1),a("div",yi,[P(a("input",{"onUpdate:modelValue":e[3]||(e[3]=o=>r.phone_number=o),id:"phone_number",name:"phone_number",type:"text",autocomplete:"phone_number",required:"",placeholder:"e.g: 0776*******",class:E([r.errors.phone_number?"border-red-500 signUpErrorIcon":"border-0","block w-full rounded-md py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-[#0157FF] sm:text-sm sm:leading-6"])},null,2),[[M,r.phone_number]])]),r.errors.phone_number?(m(),f("p",bi,p(r.errors.phone_number),1)):k("",!0)])):k("",!0),a("div",null,[a("label",vi,p(t.translations.gdc_emailcapture_email_address)+" *",1),a("div",_i,[P(a("input",{"onUpdate:modelValue":e[4]||(e[4]=o=>r.email=o),id:"email",name:"email",type:"email",autocomplete:"email",required:"",placeholder:"e.g: abc@gmail.com",class:E([r.errors.email?"border-red-500 signUpErrorIcon":"border-0","block w-full rounded-md py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-[#0157FF] sm:text-sm sm:leading-6"])},null,2),[[M,r.email]])]),r.errors.email?(m(),f("p",ki,p(r.errors.email),1)):k("",!0)]),a("div",null,[a("label",xi,[oe(p(t.translations.gdc_password)+" * ",1),a("div",Ci,[Si,a("span",Ei,p(t.translations.gdc_enter_valid_password),1)])]),a("div",Ti,[a("div",Pi,[P(a("input",{"onUpdate:modelValue":e[5]||(e[5]=o=>r.password=o),id:"password",name:"password",autocomplete:"current-password",required:"",type:r.showPassword?"text":"password",class:E([r.errors.password?"border-red-500":"border-0","block w-full rounded-md py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-[#0157FF] sm:text-sm sm:leading-6"])},null,10,ji),[[he,r.password]]),a("button",{type:"button",onClick:e[6]||(e[6]=S((...o)=>n.togglePasswordVisibility&&n.togglePasswordVisibility(...o),["stop","prevent"])),class:"absolute inset-y-0 right-0 pr-3 flex items-center text-gray-400",disabled:r.password.length==0},[r.showPassword?(m(),f("span",$i,Ai)):(m(),f("span",Li,Ri))],8,Ii)]),r.errors.password?(m(),f("p",Fi,p(r.errors.password),1)):k("",!0)])]),P(a("input",{type:"text",id:"super_secret_username",name:"username","onUpdate:modelValue":e[7]||(e[7]=o=>r.hiddenInput=o),class:"hidden"},null,512),[[M,r.hiddenInput]]),a("div",Mi,[a("div",Bi,[P(a("input",{"onUpdate:modelValue":e[8]||(e[8]=o=>r.acceptTerms=o),id:"acceptSignUpTerms",name:"acceptSignUpTerms",type:"checkbox",class:"h-4 w-4 rounded border-gray-300 text-[#0157FF] focus:ring-[#0157FF]"},null,512),[[Ae,r.acceptTerms]])]),a("div",Di,[a("label",{innerHTML:t.translations.gdc_signup_checkbox_1,for:"acceptSignUpTerms",class:"font-normal text-[#84818A] text-[14px] leading-[19px]"},null,8,Ni)])]),a("div",qi,[a("div",Hi,[P(a("input",{"onUpdate:modelValue":e[9]||(e[9]=o=>r.acceptTerms2=o),id:"acceptSignUpTerms2",name:"acceptSignUpTerms2",type:"checkbox",class:"h-4 w-4 rounded border-gray-300 text-[#0157FF] focus:ring-[#0157FF]"},null,512),[[Ae,r.acceptTerms2]])]),a("div",Vi,[a("label",{innerHTML:t.translations.gdc_signup_checkbox_2,for:"acceptSignUpTerms2",class:"font-normal text-[#84818A] text-[14px] leading-[19px]"},null,8,Gi)])]),a("div",null,[r.isSigningUp?(m(),f("span",{key:1,onClick:e[11]||(e[11]=S(()=>{},["stop","prevent"])),class:"flex bg-[#FF0000] w-full justify-center rounded-md px-3 py-3 text-sm font-semibold leading-6 text-white shadow-sm focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[#0157FF] uppercase"},Ki)):(m(),f("button",{key:0,onClick:e[10]||(e[10]=S(o=>n.signUp(),["stop","prevent"])),type:"submit",disabled:!n.allFieldsFilled(),class:E([[n.allFieldsFilled()?"bg-[#FF0000] hover:bg-[#E50000]":"bg-[#999999]"],"flex w-full justify-center rounded-md px-3 py-3 text-sm font-semibold leading-6 text-white shadow-sm focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[#0157FF] uppercase"]),"data-form-cta":"signup"},p(t.translations.gdc_cta_create_account),11,zi))])])])])])}const Yi=L(Gr,[["render",Wi]]),Xi={name:"ConfirmEmail",mounted(){document.getElementById("signup-modal").classList.remove("left-0")},props:{translations:{type:Object,required:!0}},methods:{requestNewVerificationLink(){this.$parent.currentComponent="ExpiredVerification"}}},Qi={class:"flex min-h-full flex-col justify-center"},en={class:"sm:mx-auto sm:w-full sm:max-w-[480px]"},tn={class:"bg-white md:pb-4 pt-8 sm:rounded-lg sm:px-3"},sn=a("div",{class:"flex justify-center"},[a("svg",{xmlns:"http://www.w3.org/2000/svg",width:"49",height:"49",viewBox:"0 0 49 49",fill:"none"},[a("path",{d:"M20.6145 9.1875H13.7812H10.3168H9.1875V10.0297V13.7812V17.6477V26.1652L0.0191406 19.3799C0.172266 17.6477 1.0623 16.0398 2.47871 14.9967L4.59375 13.4271V9.1875C4.59375 6.65137 6.65137 4.59375 9.1875 4.59375H16.5184L21.2939 1.0623C22.2223 0.373242 23.342 0 24.5 0C25.658 0 26.7777 0.373242 27.7061 1.05273L32.4816 4.59375H39.8125C42.3486 4.59375 44.4062 6.65137 44.4062 9.1875V13.4271L46.5213 14.9967C47.9377 16.0398 48.8277 17.6477 48.9809 19.3799L39.8125 26.1652V17.6477V13.7812V10.0297V9.1875H38.6832H35.2188H28.3855H20.6049H20.6145ZM0 42.875V23.1697L20.825 38.5971C21.8873 39.3818 23.1793 39.8125 24.5 39.8125C25.8207 39.8125 27.1127 39.3914 28.175 38.5971L49 23.1697V42.875C49 46.2533 46.2533 49 42.875 49H6.125C2.74668 49 0 46.2533 0 42.875Z",fill:"black"})])],-1),rn=["innerHTML"],nn=["innerHTML"];function on(i,e,t,s,r,n){return m(),f("div",Qi,[a("div",en,[a("div",tn,[sn,a("h2",{class:"text-center mt-3",innerHTML:t.translations.gdc_nearly_there},null,8,rn),a("p",{class:"text-center",innerHTML:t.translations.gdc_verify_account},null,8,nn)])])])}const an=L(Xi,[["render",on]]),ln={name:"Account",data(){return{isLoggingOut:!1}},props:{message:{type:String,default:""},isPremium:{type:Boolean},isUserPreferenceAvailable:{type:Boolean,default:!1},translations:{type:Object,default:{}}},mounted(){document.getElementById("signup-modal").classList.remove("left-0")},methods:{async logout(){this.isLoggingOut=!0;let i=await this.$parent.logout();i.success?(this.$parent.currentComponent="SignIn",MicroModal.close("modal-authentication"),document.body.classList.remove("overflow-hidden")):console.error(i.error),this.isLoggingOut=!1},async updatePassword(){this.$parent.currentComponent="ResetPassword"},async updateProfile(){this.$parent.currentComponent="ProfileDetails"},async updatePreference(){this.$parent.currentComponent="UserPreference"}},computed:{welcomeMessage(){return this.$parent.userSession?this.$parent.userSession.user.user_metadata.display_name:"Welcome to Gambling.com!"},isGoogleSignIn(){return this.$parent.userSession&&this.$parent.userSession.user.app_metadata.provider==="google"}}},cn={class:"flex min-h-full flex-col justify-center"},un={class:"sm:mx-auto w-full md:w-[394px] min-h-[390px] pt-0 px-2 md:px-4 pb-2"},dn={class:"bg-white sm:rounded-lg pt-[14px] pb-[20px]"},hn={class:"text-[22px] truncate pr-10 font-semibold"},pn=a("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",class:"inline pr-1 pb-1"},[a("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M20.2282 20.7349C22.5503 18.5466 24 15.4426 24 12C24 5.37258 18.6274 0 12 0C5.37258 0 0 5.37258 0 12C0 15.4426 1.44967 18.5466 3.77185 20.7349C5.92015 22.7593 8.81518 24 12 24C15.1848 24 18.0799 22.7593 20.2282 20.7349ZM4.794 19.1536C6.48568 17.0434 9.08505 15.6923 12 15.6923C14.9149 15.6923 17.5143 17.0434 19.206 19.1536C17.3665 21.0065 14.8172 22.1538 12 22.1538C9.18277 22.1538 6.63351 21.0065 4.794 19.1536ZM16.6154 8.30769C16.6154 10.8567 14.549 12.9231 12 12.9231C9.45099 12.9231 7.38462 10.8567 7.38462 8.30769C7.38462 5.75869 9.45099 3.69231 12 3.69231C14.549 3.69231 16.6154 5.75869 16.6154 8.30769Z",fill:"#000000"})],-1),mn={key:0},gn=a("div",null,[a("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none"},[a("path",{d:"M9 5L16 12L9 19",stroke:"#212121","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})])],-1),fn=a("div",null,[a("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none"},[a("path",{d:"M9 5L16 12L9 19",stroke:"#212121","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})])],-1),wn=a("div",null,[a("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none"},[a("path",{d:"M9 5L16 12L9 19",stroke:"#212121","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})])],-1),yn=a("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none"},[a("path",{d:"M16.3135 8.0625L20.2499 12L16.3135 15.9375",stroke:"#000","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),a("path",{d:"M9.75 12H20.2472",stroke:"#000","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),a("path",{d:"M9.75 20.25H4.5C4.30109 20.25 4.11032 20.171 3.96967 20.0303C3.82902 19.8897 3.75 19.6989 3.75 19.5V4.5C3.75 4.30109 3.82902 4.11032 3.96967 3.96967C4.11032 3.82902 4.30109 3.75 4.5 3.75H9.75",stroke:"#000","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1),bn={class:"font-medium text-black ml-2.5 uppercase"};function vn(i,e,t,s,r,n){return m(),f("div",cn,[a("div",un,[a("div",dn,[a("p",hn,[pn,oe(" "+p(t.translations.gdc_hello)+", "+p(n.welcomeMessage),1)]),this.message?(m(),f("p",mn,p(t.message),1)):k("",!0),a("div",{onClick:e[0]||(e[0]=S(o=>n.updateProfile(),["stop","prevent"])),class:"mb-6 flex w-full justify-center border-b border-[#ECEDEF] py-4 text-sm leading-6 uppercase cursor-pointer flex justify-between"},[a("div",null,p(t.translations.gdc_profile_details),1),gn]),t.isUserPreferenceAvailable?(m(),f("div",{key:1,onClick:e[1]||(e[1]=S(o=>n.updatePreference(),["stop","prevent"])),class:"mb-6 flex w-full justify-center border-b border-[#ECEDEF] py-4 text-sm leading-6 uppercase cursor-pointer flex justify-between"},[a("div",null,p(t.translations.gdc_email_preferences),1),fn])):k("",!0),n.isGoogleSignIn?k("",!0):(m(),f("div",{key:2,onClick:e[2]||(e[2]=S(o=>n.updatePassword(),["stop","prevent"])),class:"mb-6 flex w-full justify-center border-b border-[#ECEDEF] py-4 text-sm leading-6 uppercase cursor-pointer flex justify-between"},[a("div",null,p(t.translations.gdc_manage_password),1),wn])),a("div",{class:"flex cursor-pointer w-fit",onClick:e[3]||(e[3]=o=>n.logout())},[yn,a("span",bn,p(t.translations.gdc_sign_out),1)])])])])}const _n=L(ln,[["render",vn]]),kn={name:"ForgotPassword",props:{isExpiredLink:{type:Boolean,default:!1}},mounted(){document.getElementById("signup-modal").classList.remove("left-0")},data(){return{isSendingPasswordReset:!1,email:"",errors:{email:""}}},props:{translations:{type:Object,required:!0}},methods:{async forgotPassword(){this.errors.email="";const i=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;if(this.email?i.test(this.email)||(this.errors.email=this.translations.gdc_enter_valid_email):this.errors.email="Email is required",Object.values(this.errors).some(t=>t!==""))return;this.isSendingPasswordReset=!0;let e=await this.$parent.forgotPassword(this.email);e.success?(this.$parent.resetEmail=this.email,this.$parent.currentComponent="PasswordResetSent"):console.error(e.error),this.isSendingPasswordReset=!1},async returnToSignIn(){this.$parent.currentComponent="SignIn"},emailFilled(){return this.email.length>3}}},xn={class:"flex min-h-full flex-col justify-center"},Cn={class:"sm:mx-auto w-full md:w-[416px] pt-0 px-2 md:px-8 pb-8"},Sn=a("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"#999999",class:"size-6"},[a("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15.75 19.5 8.25 12l7.5-7.5"})],-1),En={class:"text-[#999999] font-semibold"},Tn={class:"bg-white sm:rounded-lg"},Pn={class:"text-lg font-semibold mt-5"},jn={key:0},In={for:"email",class:"block text-sm leading-6 text-gray-900"},$n={class:"mt-2"},On={key:0,class:"text-red-500 text-[14px] mt-1"},An={class:"mt-6"},Ln=["disabled"],Un=a("svg",{"aria-hidden":"true",class:"w-6 h-6 animate-spin text-white fill-gray-700 mr-2",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[a("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),a("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})],-1);function Rn(i,e,t,s,r,n){return m(),f("div",xn,[a("div",Cn,[a("div",{class:"flex cursor-pointer w-fit mt-0.5 md:mt-[18px]",onClick:e[0]||(e[0]=o=>n.returnToSignIn())},[Sn,a("span",En,p(t.translations.gdc_back),1)]),a("div",Tn,[a("div",null,[a("h2",Pn,p(t.translations.gdc_reset_password),1),this.isExpiredLink?(m(),f("p",jn,"We noticed that you attempted to reset your password, but the link has expired. Please request a new reset password link to complete setup.")):k("",!0),a("label",In,p(t.translations.gdc_emailcapture_email_address),1),a("div",$n,[P(a("input",{"onUpdate:modelValue":e[1]||(e[1]=o=>r.email=o),id:"email",name:"email",type:"email",autocomplete:"email",required:"",placeholder:"e.g: joedoe@gmail.com",class:"block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-[#0157FF] sm:text-sm sm:leading-6"},null,512),[[M,r.email]]),r.errors.email?(m(),f("p",On,p(r.errors.email),1)):k("",!0)])]),a("div",An,[r.isSendingPasswordReset?(m(),f("span",{key:1,onClick:e[3]||(e[3]=S(()=>{},["stop","prevent"])),class:"flex bg-[#FF0000] w-full justify-center rounded-md px-3 py-3 text-sm font-semibold leading-6 text-white shadow-sm focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[#0157FF] uppercase"},[Un,a("span",null,p(t.translations.gdc_send_password),1)])):(m(),f("button",{key:0,onClick:e[2]||(e[2]=S(o=>n.forgotPassword(),["stop","prevent"])),type:"submit",disabled:!n.emailFilled(),class:E([[n.emailFilled()?"bg-[#FF0000] hover:bg-[#E50000]":"bg-[#999999]"],"flex w-full justify-center rounded-md px-3 py-3 text-sm font-semibold leading-6 text-white shadow-sm focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[#0157FF] uppercase"])},p(t.translations.gdc_send_password),11,Ln))])])])])}const Fn=L(kn,[["render",Rn]]),Mn={name:"PasswordResetSent",mounted(){document.getElementById("signup-modal").classList.remove("left-0")},methods:{async forgotPassword(){this.$parent.currentComponent="ForgotPassword"},async returnToSignIn(){this.$parent.currentComponent="SignIn"}},props:{translations:{type:Object,required:!0}},data(){return{resetEmail:this.$parent.resetEmail}}},Bn={class:"flex min-h-full flex-col justify-center"},Dn={class:"sm:mx-auto w-full md:w-[416px] pt-0 px-2 md:px-8 pb-2"},Nn=a("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"#999999",class:"size-6"},[a("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15.75 19.5 8.25 12l7.5-7.5"})],-1),qn={class:"text-[#999999] font-semibold"},Hn={class:"bg-white sm:rounded-lg pb-5"},Vn={class:"text-lg font-semibold"},Gn={class:"m-0"};function zn(i,e,t,s,r,n){return m(),f("div",Bn,[a("div",Dn,[a("div",{class:"flex cursor-pointer w-fit mt-0.5 md:mt-[18px]",onClick:e[0]||(e[0]=o=>n.returnToSignIn())},[Nn,a("span",qn,p(t.translations.gdc_back),1)]),a("div",Hn,[a("h2",Vn,p(t.translations.gdc_reset_password),1),a("p",Gn,p(t.translations.gdc_reset_password_text.replace("[resetEmail]",r.resetEmail)),1),a("button",{onClick:e[1]||(e[1]=S(o=>n.forgotPassword(),["stop","prevent"])),class:"mt-3 flex bg-[#FF0000] hover:bg-[#E50000] w-full justify-center rounded-md px-3 py-3 text-sm font-semibold leading-6 text-white shadow-sm focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[#0157FF] uppercase"},p(t.translations.gdc_resend_link),1),a("button",{onClick:e[2]||(e[2]=S(o=>n.returnToSignIn(),["stop","prevent"])),class:"mt-3 flex w-full justify-center rounded-md px-3 py-3 text-sm font-semibold leading-6 shadow-sm border border-solid border-black focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[#0157FF] uppercase"},p(t.translations.gdc_sign_in),1)])])])}const Jn=L(Mn,[["render",zn]]),Zn={name:"ForgotPassword",data(){return{isUpdatingUserPassword:!1,resetPasswordError:"",password:"",passwordConfirm:"",showPassword:!1,showPasswordConfirm:!1,errors:{password:"",passwordConfirm:""},passwordUpdated:!1}},props:{translations:{type:Object,required:!0}},mounted(){document.getElementById("signup-modal").classList.remove("left-0")},methods:{async updatePassword(){this.isUpdatingUserPassword=!0,this.errors.password="",this.errors.passwordConfirm="";const i=/^(?=.*[a-z])(?=.*[A-Z]).{8,16}$/;if(this.password?i.test(this.password)||(this.errors.password=this.translations.gdc_enter_valid_password):this.errors.password="Password is required",this.passwordConfirm?this.password!==this.passwordConfirm&&(this.errors.passwordConfirm=this.translations.gdc_passwords_do_not_match):this.errors.passwordConfirm="Confirm password is required",Object.values(this.errors).some(t=>t!=="")){this.isUpdatingUserPassword=!1;return}let e=await this.$parent.updateUser({password:this.password});e.success?(this.$parent.isInPasswordRecoveryMode&&(this.$parent.isInPasswordRecoveryMode=!1),this.passwordUpdated=!0):(this.errors.password=e.error.message,this.resetPasswordHasError=!0),this.isUpdatingUserPassword=!1},async returnToAccount(){this.$parent.currentComponent="Account"},passwordFilled(){return this.password&&this.passwordConfirm},togglePasswordVisibility(){this.showPassword=!this.showPassword},togglePasswordConfirmVisibility(){this.showPasswordConfirm=!this.showPasswordConfirm}},computed:{shouldDisplayReturnToAccountButton(){return this.$parent.isInPasswordRecoveryMode}}},Kn={class:"flex min-h-full flex-col justify-center"},Wn={class:"sm:mx-auto w-full md:w-[394px] min-h-[390px] pt-0 px-2 md:px-4 pb-8"},Yn={class:"bg-white sm:rounded-lg"},Xn={action:"#",method:"POST"},Qn={class:"md:mt-4"},eo=a("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"#999999",class:"size-6"},[a("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15.75 19.5 8.25 12l7.5-7.5"})],-1),to={class:"text-[#999999] font-semibold"},so={class:"text-[20px] font-semibold mt-4"},ro={for:"password",class:"flex items-center block text-[14px] mb-1.5 leading-6 text-gray-900"},io={class:"group inline-block relative ml-1"},no=a("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 14 14",fill:"none"},[a("path",{d:"M6.5 6.5L6.52766 6.48617C6.90974 6.29513 7.33994 6.64023 7.23634 7.05465L6.76366 8.94535C6.66006 9.35977 7.09026 9.70487 7.47234 9.51383L7.5 9.5M13 7C13 10.3137 10.3137 13 7 13C3.68629 13 1 10.3137 1 7C1 3.68629 3.68629 1 7 1C10.3137 1 13 3.68629 13 7ZM7 4.5H7.005V4.505H7V4.5Z",stroke:"#0157FF","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"})],-1),oo={class:"text-[14px] w-[200px] bg-gdc-gray-100 text-black p-[5px] rounded-md invisible absolute left-[15px] z-[1] group-hover:visible"},ao={class:"relative"},lo=["type"],co=["disabled"],uo={key:0},ho=a("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"},[a("path",{d:"M10 12.5C11.3807 12.5 12.5 11.3807 12.5 10C12.5 8.61929 11.3807 7.5 10 7.5C8.61929 7.5 7.5 8.61929 7.5 10C7.5 11.3807 8.61929 12.5 10 12.5Z",fill:"#0F172A"}),a("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M0.664255 10.5904C0.517392 10.2087 0.517518 9.78563 0.66461 9.40408C2.10878 5.65788 5.7433 3 9.99859 3C14.256 3 17.892 5.66051 19.3347 9.40962C19.4816 9.79127 19.4814 10.2144 19.3344 10.5959C17.8902 14.3421 14.2557 17 10.0004 17C5.74298 17 2.10698 14.3395 0.664255 10.5904ZM14.0004 10C14.0004 12.2091 12.2095 14 10.0004 14C7.79123 14 6.00037 12.2091 6.00037 10C6.00037 7.79086 7.79123 6 10.0004 6C12.2095 6 14.0004 7.79086 14.0004 10Z",fill:"#0F172A"})],-1),po=[ho],mo={key:1},go=a("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"16",viewBox:"0 0 20 16",fill:"none"},[a("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M3.28033 0.21967C2.98744 -0.0732233 2.51256 -0.0732233 2.21967 0.21967C1.92678 0.512563 1.92678 0.987437 2.21967 1.28033L16.7197 15.7803C17.0126 16.0732 17.4874 16.0732 17.7803 15.7803C18.0732 15.4874 18.0732 15.0126 17.7803 14.7197L16.0352 12.9745C17.5064 11.8594 18.6595 10.3465 19.3344 8.59593C19.4814 8.21437 19.4816 7.79127 19.3347 7.40962C17.892 3.66051 14.256 1 9.99859 1C8.28207 1 6.66657 1.43249 5.2551 2.19444L3.28033 0.21967ZM7.75194 4.69128L8.84367 5.78301C9.18951 5.60223 9.58291 5.5 10.0002 5.5C11.3809 5.5 12.5002 6.61929 12.5002 8C12.5002 8.41727 12.398 8.81067 12.2172 9.15651L13.3091 10.2484C13.7454 9.60769 14.0004 8.83362 14.0004 8C14.0004 5.79086 12.2095 4 10.0004 4C9.16675 4 8.39268 4.25501 7.75194 4.69128Z",fill:"black"}),a("path",{d:"M10.7484 11.9302L13.2711 14.4529C12.2462 14.8074 11.1458 15 10.0004 15C5.74298 15 2.10698 12.3395 0.664255 8.59038C0.517392 8.20873 0.517518 7.78563 0.66461 7.40408C1.15603 6.12932 1.90108 4.98057 2.83791 4.01969L6.0702 7.25198C6.02436 7.4943 6.00037 7.74435 6.00037 8C6.00037 10.2091 7.79123 12 10.0004 12C10.256 12 10.5061 11.976 10.7484 11.9302Z",fill:"black"})],-1),fo=[go],wo={key:0,class:"text-red-500 text-[14px] mt-1"},yo={class:"mt-5"},bo={for:"passwordConfirm",class:"block text-[14px] mb-1.5 leading-6 text-gray-900"},vo={class:"relative"},_o=["type"],ko=["disabled"],xo={key:0},Co=a("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none"},[a("path",{d:"M10 12.5C11.3807 12.5 12.5 11.3807 12.5 10C12.5 8.61929 11.3807 7.5 10 7.5C8.61929 7.5 7.5 8.61929 7.5 10C7.5 11.3807 8.61929 12.5 10 12.5Z",fill:"#0F172A"}),a("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M0.664255 10.5904C0.517392 10.2087 0.517518 9.78563 0.66461 9.40408C2.10878 5.65788 5.7433 3 9.99859 3C14.256 3 17.892 5.66051 19.3347 9.40962C19.4816 9.79127 19.4814 10.2144 19.3344 10.5959C17.8902 14.3421 14.2557 17 10.0004 17C5.74298 17 2.10698 14.3395 0.664255 10.5904ZM14.0004 10C14.0004 12.2091 12.2095 14 10.0004 14C7.79123 14 6.00037 12.2091 6.00037 10C6.00037 7.79086 7.79123 6 10.0004 6C12.2095 6 14.0004 7.79086 14.0004 10Z",fill:"#0F172A"})],-1),So=[Co],Eo={key:1},To=a("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"16",viewBox:"0 0 20 16",fill:"none"},[a("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M3.28033 0.21967C2.98744 -0.0732233 2.51256 -0.0732233 2.21967 0.21967C1.92678 0.512563 1.92678 0.987437 2.21967 1.28033L16.7197 15.7803C17.0126 16.0732 17.4874 16.0732 17.7803 15.7803C18.0732 15.4874 18.0732 15.0126 17.7803 14.7197L16.0352 12.9745C17.5064 11.8594 18.6595 10.3465 19.3344 8.59593C19.4814 8.21437 19.4816 7.79127 19.3347 7.40962C17.892 3.66051 14.256 1 9.99859 1C8.28207 1 6.66657 1.43249 5.2551 2.19444L3.28033 0.21967ZM7.75194 4.69128L8.84367 5.78301C9.18951 5.60223 9.58291 5.5 10.0002 5.5C11.3809 5.5 12.5002 6.61929 12.5002 8C12.5002 8.41727 12.398 8.81067 12.2172 9.15651L13.3091 10.2484C13.7454 9.60769 14.0004 8.83362 14.0004 8C14.0004 5.79086 12.2095 4 10.0004 4C9.16675 4 8.39268 4.25501 7.75194 4.69128Z",fill:"black"}),a("path",{d:"M10.7484 11.9302L13.2711 14.4529C12.2462 14.8074 11.1458 15 10.0004 15C5.74298 15 2.10698 12.3395 0.664255 8.59038C0.517392 8.20873 0.517518 7.78563 0.66461 7.40408C1.15603 6.12932 1.90108 4.98057 2.83791 4.01969L6.0702 7.25198C6.02436 7.4943 6.00037 7.74435 6.00037 8C6.00037 10.2091 7.79123 12 10.0004 12C10.256 12 10.5061 11.976 10.7484 11.9302Z",fill:"black"})],-1),Po=[To],jo={key:0,class:"text-red-500 text-[14px] mt-1"},Io={key:0,class:"text-[#249B1B] text-[14px] mt-4"},$o=["disabled"],Oo=a("svg",{"aria-hidden":"true",class:"w-6 h-6 animate-spin text-white fill-gray-700 mr-2",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[a("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),a("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})],-1);function Ao(i,e,t,s,r,n){return m(),f("div",Kn,[a("div",Wn,[a("div",Yn,[a("form",Xn,[a("div",Qn,[n.shouldDisplayReturnToAccountButton?k("",!0):(m(),f("div",{key:0,class:"flex cursor-pointer w-fit ml-[-8px]",onClick:e[0]||(e[0]=o=>n.returnToAccount())},[eo,a("span",to,p(t.translations.gdc_back),1)])),a("h2",so,p(t.translations.gdc_update_password),1),a("label",ro,[oe(p(t.translations.gdc_new_password)+" * ",1),a("div",io,[no,a("span",oo,p(t.translations.gdc_enter_valid_password),1)])]),a("div",null,[a("div",ao,[P(a("input",{"onUpdate:modelValue":e[1]||(e[1]=o=>r.password=o),id:"password",name:"password",type:r.showPassword?"text":"password",autocomplete:"current-password",required:"",class:E([r.errors.password?"border-red-500":"border-0","block w-full rounded-md py-2 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-[#0157FF] sm:text-sm sm:leading-6"])},null,10,lo),[[he,r.password]]),a("button",{type:"button",onClick:e[2]||(e[2]=S((...o)=>n.togglePasswordVisibility&&n.togglePasswordVisibility(...o),["stop","prevent"])),class:"absolute inset-y-0 right-0 pr-3 flex items-center text-gray-400",disabled:r.password.length==0},[r.showPassword?(m(),f("span",uo,po)):(m(),f("span",mo,fo))],8,co)]),r.errors.password?(m(),f("p",wo,p(r.errors.password),1)):k("",!0)])]),a("div",yo,[a("label",bo,p(t.translations.gdc_confirm_new_password)+" *",1),a("div",null,[a("div",vo,[P(a("input",{"onUpdate:modelValue":e[3]||(e[3]=o=>r.passwordConfirm=o),id:"passwordConfirm",name:"passwordConfirm",type:r.showPasswordConfirm?"text":"password",required:"",autocomplete:"current-password",class:E([r.errors.passwordConfirm?"border-red-500":"border-0","block w-full rounded-md py-2 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-[#0157FF] sm:text-sm sm:leading-6"])},null,10,_o),[[he,r.passwordConfirm]]),a("button",{type:"button",onClick:e[4]||(e[4]=S((...o)=>n.togglePasswordConfirmVisibility&&n.togglePasswordConfirmVisibility(...o),["stop","prevent"])),class:"absolute inset-y-0 right-0 pr-3 flex items-center text-gray-400",disabled:r.passwordConfirm.length==0},[r.showPasswordConfirm?(m(),f("span",xo,So)):(m(),f("span",Eo,Po))],8,ko)]),r.errors.passwordConfirm?(m(),f("p",jo,p(r.errors.passwordConfirm),1)):k("",!0)])]),r.passwordUpdated?(m(),f("p",Io,p(t.translations.gdc_password_updated),1)):k("",!0),a("div",{class:E(r.passwordUpdated?"mt-3":"mt-8")},[r.isUpdatingUserPassword?(m(),f("span",{key:1,onClick:e[6]||(e[6]=S(()=>{},["stop","prevent"])),class:"flex bg-black w-full justify-center rounded-md px-3 py-3 text-sm font-semibold leading-6 text-white shadow-sm focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[#0157FF] uppercase"},[Oo,a("span",null,p(t.translations.gdc_update_password),1)])):(m(),f("button",{key:0,onClick:e[5]||(e[5]=S(o=>n.updatePassword(),["stop","prevent"])),type:"submit",disabled:!n.passwordFilled(),class:E([[n.passwordFilled()?"bg-[#FFFFFF] hover:bg-[#000000] text-black border border-black hover:border-white hover:bg-black":"bg-[#999999] text-white "],"flex w-full justify-center rounded-md px-3 py-3 text-sm font-semibold leading-6 shadow-sm focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[#0157FF] uppercase hover:text-white"])},p(t.translations.gdc_update_password),11,$o))],2)])])])])}const Lo=L(Zn,[["render",Ao]]),Uo={name:"ProfileDetails",data(){return{isUpdatingProfile:!1,name:"",nickname:"",errors:{name:"",nickname:""},profileUpdated:!1}},props:{translations:{type:Object,default:{}}},mounted(){document.getElementById("signup-modal").classList.remove("left-0"),this.name=this.$parent.userSession.user.user_metadata.name,this.nickname=this.$parent.userSession.user.user_metadata.nickname,this.$parent.userSession.user.user_metadata.name&&(document.getElementById("profile-details-name").value=this.name),this.$parent.userSession.user.user_metadata.nickname&&(document.getElementById("profile-details-nickname").value=this.nickname)},methods:{async updateProfile(){if(this.isUpdatingProfile=!0,this.errors.name="",this.errors.nickname="",this.name?this.name.length<=3?this.errors.name="Your name must be longer than 3 characters":this.name.length>30&&(this.errors.name="Your name must not be longer than 30 characters"):this.errors.name="Name is required",this.nickname&&this.nickname.length<=3?this.errors.nickname="Your nickname must be longer than 3 characters":this.nickname&&this.nickname.length>30&&(this.errors.nickname="Your nickname must not be longer than 30 characters"),Object.values(this.errors).some(e=>e!=="")){this.isUpdatingProfile=!1;return}let i=await this.$parent.updateUser({data:{name:this.name,nickname:this.nickname,display_name:this.nickname?this.nickname:this.name}});i.success?this.profileUpdated=!0:this.errors.name=i.error.message,this.isUpdatingProfile=!1},async returnToAccount(){this.$parent.currentComponent="Account"},nameFilled(){return this.name.length>=3}}},Ro={class:"flex min-h-full flex-col justify-center"},Fo={class:"sm:mx-auto w-full md:w-[394px] min-h-[390px] pt-0 px-2 md:px-4 pb-8"},Mo={class:"bg-white sm:rounded-lg"},Bo={action:"#",method:"POST"},Do={class:"md:mt-4"},No=a("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"#999999",class:"size-6"},[a("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15.75 19.5 8.25 12l7.5-7.5"})],-1),qo={class:"text-[#999999] font-semibold"},Ho={class:"text-[20px] font-semibold mt-4 mb-2"},Vo={class:"text-[14px] mt-4"},Go={for:"profile-details-name",class:"flex items-center block text-[14px] leading-6 text-gray-900 mt-3 mb-1.5"},zo={class:"relative"},Jo={key:0,class:"text-red-500 text-[14px] mt-1"},Zo={class:"mt-4"},Ko={for:"profile-details-nickname",class:"flex items-center block text-[14px] mb-1.5 leading-6 text-gray-900"},Wo={class:"relative"},Yo={key:0,class:"text-red-500 text-[14px] mt-1"},Xo={key:0,class:"text-[#249B1B] text-[14px] mt-4"},Qo=["disabled"],ea=a("svg",{"aria-hidden":"true",class:"w-6 h-6 animate-spin text-white fill-gray-700 mr-2",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[a("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),a("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})],-1);function ta(i,e,t,s,r,n){return m(),f("div",Ro,[a("div",Fo,[a("div",Mo,[a("form",Bo,[a("div",Do,[a("div",{class:"flex cursor-pointer w-fit ml-[-8px]",onClick:e[0]||(e[0]=o=>n.returnToAccount())},[No,a("span",qo,p(t.translations.gdc_back),1)]),a("h2",Ho,p(t.translations.gdc_profile_details),1),a("span",Vo,p(t.translations.gdc_login_required_fields),1),a("label",Go,p(t.translations.gdc_name)+" * ",1),a("div",null,[a("div",zo,[P(a("input",{"onUpdate:modelValue":e[1]||(e[1]=o=>r.name=o),id:"profile-details-name",name:"profile-details-name",type:"text",autocomplete:"given-name",required:"",placeholder:"e.g: John",class:E([r.errors.name?"border-red-500":"border-0","block w-full rounded-md py-2 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-[#0157FF] sm:text-sm sm:leading-6"])},null,2),[[M,r.name]])]),r.errors.name?(m(),f("p",Jo,p(r.errors.name),1)):k("",!0)])]),a("div",Zo,[a("label",Ko,p(t.translations.gdc_nickname)+" ("+p(t.translations.gdc_optional)+") ",1),a("div",null,[a("div",Wo,[P(a("input",{"onUpdate:modelValue":e[2]||(e[2]=o=>r.nickname=o),id:"profile-details-nickname",name:"profile-details-nickname",type:"text",placeholder:"e.g: HighRoller",class:"block w-full rounded-md py-2 text-gray-900 shadow-sm border-0 ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-[#0157FF] sm:text-sm sm:leading-6"},null,512),[[M,r.nickname]])]),r.errors.nickname?(m(),f("p",Yo,p(r.errors.nickname),1)):k("",!0)])]),r.profileUpdated?(m(),f("p",Xo,p(t.translations.gdc_profile_details_updated),1)):k("",!0),a("div",{class:E(r.profileUpdated?"mt-3":"mt-6")},[r.isUpdatingProfile?(m(),f("span",{key:1,onClick:e[4]||(e[4]=S(()=>{},["stop","prevent"])),class:"flex bg-black w-full justify-center rounded-md px-3 py-3 text-sm font-semibold leading-6 text-white shadow-sm focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[#0157FF] uppercase"},[ea,a("span",null,p(t.translations.gdc_save_changes),1)])):(m(),f("button",{key:0,onClick:e[3]||(e[3]=S(o=>n.updateProfile(),["stop","prevent"])),type:"submit",disabled:!n.nameFilled(),class:E([[n.nameFilled()?"bg-[#FFFFFF] hover:bg-[#000000] text-black border border-black hover:border-white hover:bg-black":"bg-[#999999] text-white "],"flex w-full justify-center rounded-md px-3 py-3 text-sm font-semibold leading-6 shadow-sm focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[#0157FF] uppercase hover:text-white"])},p(t.translations.gdc_save_changes),11,Qo))],2)])])])])}const sa=L(Uo,[["render",ta]]),ra={name:"UserPreference",props:{preference:{type:Object,required:!0},translations:{type:Object,required:!0}},data(){return{topics:null,updateDebounce:null}},mounted(){this.topics=this.preference.topics},methods:{async returnToAccount(){this.$parent.currentComponent="Account"},updateUserPreference(i){let e={};this.topics.forEach(t=>{t.identifier==i.target.name&&(t.subscribed=i.target.checked),e[t.identifier]=t.subscribed}),this.updateDebounce!==null&&clearTimeout(this.updateDebounce),this.updateDebounce=setTimeout(()=>{this.$parent.updateUserPreference(e),this.updateDebounce=null},1e3)}}},ia={class:"flex min-h-full flex-col justify-center"},na={class:"sm:mx-auto w-full md:w-[394px] min-h-[390px] pt-0 px-2 md:px-4 pb-8"},oa={class:"bg-white sm:rounded-lg"},aa={action:"#",method:"POST"},la={class:"md:mt-4"},ca=a("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"#999999",class:"size-6"},[a("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15.75 19.5 8.25 12l7.5-7.5"})],-1),ua={class:"text-[#999999] font-semibold"},da={class:"text-[20px] font-semibold mt-4 mb-2"},ha={class:"text-[14px] mt-4"},pa={class:"mt-5"},ma={class:"flex items-center justify-between cursor-pointer"},ga={class:"text-base"},fa=["checked","name"],wa=a("div",{class:"relative w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-blue-300 rounded-full peer peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-blue-600"},null,-1),ya={key:0,class:"text-[14px] mt-2"};function ba(i,e,t,s,r,n){return m(),f("div",ia,[a("div",na,[a("div",oa,[a("form",aa,[a("div",la,[a("div",{class:"flex cursor-pointer w-fit ml-[-8px]",onClick:e[0]||(e[0]=o=>n.returnToAccount())},[ca,a("span",ua,p(t.translations.gdc_back),1)]),a("h2",da,p(t.translations.gdc_newsletter_preferences),1),a("span",ha,p(t.translations.gdc_newsletter_preferences_intro),1),a("div",pa,[(m(!0),f(dt,null,ht(this.topics,(o,l)=>(m(),f("div",{key:o.identifier,class:E({"mt-5":l!=0})},[a("label",ma,[a("span",ga,p(t.translations["gdc_"+o.name.toLowerCase().replaceAll(" ","_")]),1),a("input",{type:"checkbox",value:"",class:"sr-only peer",checked:o.subscribed,onChange:e[1]||(e[1]=(...c)=>n.updateUserPreference&&n.updateUserPreference(...c)),name:o.identifier},null,40,fa),wa]),o.name!=o.description?(m(),f("div",ya,p(t.translations["gdc_"+o.name.toLowerCase().replaceAll(" ","_")+"_topic_description"]),1)):k("",!0)],2))),128))])])])])])])}const va=L(ra,[["render",ba]]),_a={name:"ExpiredVerification",mounted(){document.getElementById("signup-modal").classList.remove("left-0")},props:{translations:{type:Object,required:!0}},data(){return{email:"",errors:{email:""},resendLinkSuccess:!1,resendLinkFailure:!1}},methods:{async resendVerificationEmail(){this.errors.email="";const i=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;this.email?i.test(this.email)||(this.errors.email=this.translations.gdc_enter_valid_email):this.errors.email="Email is required",!Object.values(this.errors).some(e=>e!=="")&&((await this.$parent.resendVerificationEmail(this.email)).success?this.resendLinkSuccess=!0:this.resendLinkSuccess=!1)},emailFilled(){return this.email.length>3}}},ka={class:"flex min-h-full flex-col justify-center"},xa={class:"sm:mx-auto w-full md:w-[416px] pt-0 px-2 md:px-8 pb-8"},Ca={class:"bg-white sm:rounded-lg"},Sa={class:"text-lg font-semibold"},Ea={for:"email",class:"block text-sm font-medium leading-6 text-gray-900"},Ta={class:"mt-2"},Pa={key:0,class:"text-red-500 text-[14px] mt-1"},ja={class:"mt-6"},Ia=["disabled"],$a={key:0,class:"text-red-500 text-[14px] mt-1"},Oa={key:1,class:"text-[#249B1B] text-[14px] mt-1"};function Aa(i,e,t,s,r,n){return m(),f("div",ka,[a("div",xa,[a("div",Ca,[a("div",null,[a("h2",Sa,p(t.translations.gdc_expired_verification),1),a("p",null,p(t.translations.gdc_expired_verification_text),1),a("label",Ea,p(t.translations.gdc_emailcapture_email_address),1),a("div",Ta,[P(a("input",{"onUpdate:modelValue":e[0]||(e[0]=o=>r.email=o),id:"email",name:"email",type:"email",autocomplete:"email",required:"",placeholder:"e.g: joedoe@gmail.com",class:"block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-[#0157FF] sm:text-sm sm:leading-6"},null,512),[[M,r.email]]),r.errors.email?(m(),f("p",Pa,p(r.errors.email),1)):k("",!0)])]),a("div",ja,[a("button",{onClick:e[1]||(e[1]=S(o=>n.resendVerificationEmail(),["stop","prevent"])),type:"submit",disabled:!n.emailFilled(),class:E([[n.emailFilled()?"bg-[#FF0000] hover:bg-[#E50000]":"bg-[#999999]"],"flex w-full justify-center rounded-md px-3 py-3 text-sm font-semibold leading-6 text-white shadow-sm focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[#0157FF] uppercase"])},p(t.translations.gdc_resend_link),11,Ia)]),r.resendLinkFailure?(m(),f("p",$a,"Fail to send verification link. Please make sure you have entered correct email.")):k("",!0),r.resendLinkSuccess?(m(),f("p",Oa,p(t.translations.gdc_verification_link_sent),1)):k("",!0)])])])}const La=L(_a,[["render",Aa]]),Ua={name:"Supabase",components:{SignIn:Vr,SignUp:Yi,ConfirmEmail:an,Account:_n,ForgotPassword:Fn,PasswordResetSent:Jn,ResetPassword:Lo,ProfileDetails:sa,UserPreference:va,ExpiredVerification:La},props:{supabaseUrl:{type:String,required:!0},supabaseAnonKey:{type:String,required:!0},defaultGeo:{type:String,required:!0},userGeo:{type:String,default:null,required:!1},userRegion:{type:String,default:null,required:!1},premium:{type:Number,default:0,required:!0},userPreference:{type:Object,default:null},translations:{type:Object,default:null},lastClickedButton:{type:String,default:null,required:!1},isGoogleSignUp:{type:Boolean,default:!1,required:!1},websiteRef:{type:String,default:"gambling_com",required:!1}},data(){return{client:null,userIsAuthenticated:!1,userSession:null,isInPasswordRecoveryMode:!1,message:"",resetEmail:"",modal:null,currentComponent:$cookies.get("gdc-user")&&$cookies.get("gdc-user")=="login"?"SignIn":"SignUp",preference:null,isExpiredResetPasswordLink:!1}},mounted(){this.init(),this.subscribe(),this.initModal(),this.initAccessors(),document.querySelector("#unlock-button").addEventListener("click",i=>{$cookies.get("gdc-user")&&$cookies.get("gdc-user")=="login"?this.currentComponent="SignIn":this.currentComponent="SignUp"}),document.querySelectorAll(".signin-button-content-component").forEach(i=>{i.addEventListener("click",e=>{this.currentComponent="SignIn"})}),document.querySelectorAll(".unlock-button-content-component").forEach(i=>{i.addEventListener("click",e=>{this.currentComponent="SignUp"})}),setInterval(()=>{document.querySelectorAll(".signin-button-comments").forEach(i=>{i.addEventListener("click",e=>{this.currentComponent="SignIn"})}),document.querySelectorAll(".signup-button-comments").forEach(i=>{i.addEventListener("click",e=>{this.currentComponent="SignUp"})})},3e3),document.querySelector("#login-button").addEventListener("click",i=>{this.currentComponent="SignIn"}),setInterval(()=>{document.getElementById("signup-modal").checkVisibility()||(this.message="",this.userIsAuthenticated&&(this.currentComponent="Account"))},2e3),window.location.hash&&window.location.hash==="#error=access_denied&error_code=403&error_description=Email+link+is+invalid+or+has+expired"&&(window.location.search.includes("reset-password=true")?(this.currentComponent="ForgotPassword",this.isExpiredResetPasswordLink=!0):this.currentComponent="ExpiredVerification",MicroModal.show("modal-authentication"))},methods:{init(){this.client=er(this.supabaseUrl,this.supabaseAnonKey)},initAccessors(){window.supabase_access={getUser:async()=>{let i=await this.getUser();return i.success?i.data.user:null},updateUser:async i=>await this.updateUser(i),register:async(i,e,t,s="",r="",n=!1,o=null,l="")=>await this.register(i,e,t,s,r,n,o,l),login:async(i,e)=>await this.login(i,e),session:async()=>await this.client.auth.getSession()}},changeCurrentComponent(i){this.currentComponent=i},initModal(){MicroModal.init({targetModal:"modal-authentication",openTrigger:"data-custom-open-supabase",onShow:function(){document.body.classList.add("overflow-hidden"),document.getElementById("js-mobile-navbar")&&(document.getElementById("js-mobile-navbar").classList.contains("hidden")||(document.getElementById("js-mobile-navbar").classList.add("hidden"),document.querySelectorAll(".js-btn-navigation-mobile").forEach(function(i){i.classList.remove("open")}),document.getElementById("mainNavMobile").style.height="auto",document.getElementById("openNavMenuIcon").classList.remove("hidden"),document.getElementById("CloseNavMenuIcon").classList.remove("!block")))},onClose:function(){document.body.classList.remove("overflow-hidden")}})},subscribe(){this.client.auth.onAuthStateChange((i,e)=>{this.$emit("authstatechange",{event:i,session:e,premium:this.premium}),i==="INITIAL_SESSION"||(i==="SIGNED_IN"?(this.userSession=e,this.userIsAuthenticated=!0,this.removeGate(),this.currentComponent!=="PasswordRecovery"&&(this.currentComponent="Account")):i==="SIGNED_OUT"?(this.userSession=null,this.userIsAuthenticated=!1,this.currentComponent="SignIn",document.getElementById("gdc-signup-user").innerHTML="",document.getElementById("gdc-signup-text").classList.remove("hidden"),MicroModal.close("modal-authentication")):i==="PASSWORD_RECOVERY"?(this.currentComponent="ResetPassword",this.isInPasswordRecoveryMode=!0):i==="TOKEN_REFRESHED"||i==="USER_UPDATED"&&(this.userSession=e))})},async login(i,e){const{data:t,error:s}=await this.client.auth.signInWithPassword({email:i,password:e});return s?{success:!1,data:null,error:s}:{success:!0,data:t,error:null}},async loginOAuth(i){const{data:e,error:t}=await this.client.auth.signInWithOAuth({provider:i});return t?{success:!1,data:null,error:t}:{success:!0,data:e,error:null}},async logout(){const{error:i}=await this.client.auth.signOut();if(i)if(i.__isAuthError)await this.client.auth.refreshSession();else return{success:!1,data:null,error:i};return $cookies.set("gdc-user","login"),localStorage.removeItem("isLoggedInGDC"),{success:!0,data:null,error:null}},async register(i,e,t,s="",r="",n=!1,o=null,l=""){const{data:c,error:d}=await this.client.auth.signUp({email:i,password:e,options:{data:{name:t,nickname:s,display_name:r,country:this.currentUserGeo,region:this.currentUserRegion,register_page_url:window.location.href,accepted_terms:n,age_verified:!1,phone_number:l,customer_email:i,register_method:this.registerMethod,freemium_form:this.freemiumForm,website_ref:this.websiteRef},emailRedirectTo:o?`${window.location.origin}${o}`:`${window.location.origin}${window.location.pathname}`}});return c.user&&c.user.identities&&c.user.identities.length===0?{success:!1,data:null,error:{message:"An account with this email already exists."}}:d?{success:!1,data:null,error:d}:(this.$emit("newuser",{email:i,name:t,nickname:s,display_name:r,phone_number:l}),$cookies.set("gdc-user",1),{success:!0,data:null,error:null})},async forgotPassword(i){const{data:e,error:t}=await this.client.auth.resetPasswordForEmail(i,{redirectTo:window.location.hostname+window.location.pathname});return t?{success:!1,data:null,error:t}:{success:!0,data:e,error:null}},async updateUser(i){const{data:e,error:t}=await this.client.auth.updateUser(i);return t?{success:!1,data:null,error:t}:{success:!0,data:e,error:null}},async getUser(){const{data:i,error:e}=await this.client.auth.getUser();return e?{success:!1,data:null,error:e}:{success:!0,data:i,error:null}},async resendVerificationEmail(i){const{data:e,error:t}=await this.client.auth.resend({type:"signup",email:i});return t?{success:!1,data:null,error:t}:{success:!0,data:e,error:null}},async setupEmailCapture(){this.userSession.user.user_metadata.accepted_terms===!0&&this.userSession.user.user_metadata.email_capture_processed!==!0&&(this.emailCapture({agree:this.userSession.user.user_metadata.accepted_terms?"on":"",country:this.userSession.user.user_metadata.geo,current_url:this.userSession.user.user_metadata.signup_url,email:this.userSession.user.email,hidden_input:"",product_type_feature:"",us_state:this.userSession.user.user_metadata.region?this.userSession.user.user_metadata.region:"",debug:"supabase-auth-component"}),this.updateUser({data:{email_capture_processed:!0}}))},async emailCapture(i){this.$emit("emailcapture",i)},async updateUserPreference(i){this.$emit("updateUserPreference",{customer_email:this.userSession.user.email,topics:i})},removeGate(){localStorage.setItem("isLoggedInGDC","true"),MicroModal.close("modal-authentication")}},computed:{currentUserGeo(){return this.userGeo!==null?this.userGeo:this.defaultGeo},currentUserRegion(){return this.userRegion!==null?this.userRegion:""},isPremium(){return this.premium===1},isUserPreferenceAvailable(){return this.preference!==null},signUpTAndC(){return this.translations?this.translations.signUpTAndC:""},freemiumForm(){return this.lastClickedButton!==null?this.lastClickedButton:""},registerMethod(){return this.isGoogleSignUp?"google":"email"}},watch:{userPreference(i,e){this.preference===null&&(this.preference=i)}}};function Ra(i,e,t,s,r,n){const o=R("SignIn"),l=R("SignUp"),c=R("ConfirmEmail"),d=R("Account"),u=R("ForgotPassword"),h=R("PasswordResetSent"),g=R("ResetPassword"),w=R("ProfileDetails"),y=R("UserPreference"),x=R("ExpiredVerification");return r.currentComponent==="SignIn"?(m(),F(o,{key:0,translations:t.translations},null,8,["translations"])):r.currentComponent==="SignUp"?(m(),F(l,{key:1,"t-and-c":n.signUpTAndC,translations:t.translations},null,8,["t-and-c","translations"])):r.currentComponent==="ConfirmEmail"?(m(),F(c,{key:2,translations:t.translations},null,8,["translations"])):r.currentComponent==="Account"?(m(),F(d,{key:3,message:r.message,"is-premium":n.isPremium,"is-user-preference-available":n.isUserPreferenceAvailable,translations:t.translations},null,8,["message","is-premium","is-user-preference-available","translations"])):r.currentComponent==="ForgotPassword"?(m(),F(u,{key:4,"is-expired-link":this.isExpiredResetPasswordLink,translations:t.translations},null,8,["is-expired-link","translations"])):r.currentComponent==="PasswordResetSent"?(m(),F(h,{key:5,translations:t.translations},null,8,["translations"])):r.currentComponent==="ResetPassword"?(m(),F(g,{key:6,translations:t.translations},null,8,["translations"])):r.currentComponent==="ProfileDetails"?(m(),F(w,{key:7,translations:t.translations},null,8,["translations"])):r.currentComponent==="UserPreference"&&n.isUserPreferenceAvailable?(m(),F(y,{key:8,preference:this.preference,translations:t.translations},null,8,["preference","translations"])):r.currentComponent==="ExpiredVerification"?(m(),F(x,{key:9,translations:t.translations},null,8,["translations"])):k("",!0)}const Fa=L(Ua,[["render",Ra]]);window.addEventListener("DOMContentLoaded",function(){createApp({components:{supabase:Fa},data(){return{userGeo:null,userRegion:document.querySelector("html").dataset.regioncode?document.querySelector("html").dataset.regioncode.toUpperCase():null,passwordRecoveryMode:!1,supabaseUrl:"https://account.gambling.com",supabaseAnonKey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InV1a292YWxzZ2JrcmhwYnplY2l6Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3MTIzMTM2OTcsImV4cCI6MjAyNzg4OTY5N30.vCOBrONjU5T8ygiVdkeDnqsBTOQhViY5E72N3Y4xDA0",signedIn:!1,supabaseWorkerAPI:"https://gdc-customer-io-worker.kaxtest.workers.dev",supabaseWorkerToken:"Bearer uXq2;.xsd-0Zk8nI",userPreference:null,initSessionDetected:!1,checkBlurSectionHeightInterval:null,lastClickedButton:null,freemiumFormListeners:[{selector:"#login-button",value:"sign_in_button"},{selector:"#unlock-button",value:"unlock_button"},{selector:"#authentication-trigger",value:"top_nav_button"},{selector:"#user-login-wrap",value:"top_nav_button"},{selector:"#slot-login-signup-button",value:"slot-games"},{selector:".unlock-button-content-component",value:"component_gate",multi:!0},{selector:".signin-button-content-component",value:"component_gate",multi:!0},{selector:".signup-button-comments",value:"comments",multi:!0},{selector:".signin-button-comments",value:"comments",multi:!0}]}},watch:{signedIn:function(i){const e=document.getElementById("user-login-wrap");i?(e.classList.remove("md:hidden","lg:flex"),e.classList.add("sm:flex")):(e.classList.add("md:hidden","lg:flex"),e.classList.remove("sm:flex"))}},mounted(){this.freemiumFormListeners.forEach(({selector:i,value:e,multi:t})=>{this.setupFreemiumFormListener(i,e,t)}),this.setupUserGeo()},methods:{setupFreemiumFormListener(i,e,t=!1){const s=n=>{this.lastClickedButton=e};(t?document.querySelectorAll(i):[document.querySelector(i)]).forEach(n=>{n&&(n.addEventListener("touchstart",s),n.addEventListener("click",s))})},setupUserGeo(){const i=document.querySelector("html").dataset.ipcountry,e=document.querySelector("body").dataset.country;this.userGeo=i?i.toUpperCase():e?e.toUpperCase():null},async handleSupabaseHandoffToCustomerIO(i){var s;((s=(await new ut().subscribe(i)).status)==null?void 0:s.toLowerCase())==="subscribed"&&i.hidden_input===""&&ktag.subscribe(i.email)},async authStateChange(i){switch(window.dispatchEvent(new CustomEvent("authstatechange",{detail:i})),i.event){case"INITIAL_SESSION":this.initSessionDetected=!0,this.createBlurSection(i.premium);break;case"SIGNED_IN":this.handleSignedIn(i);break;case"SIGNED_OUT":this.handleSignedOut(i);break;case"PASSWORD_RECOVERY":document.querySelector("#user-login-wrap").click(),this.passwordRecoveryMode=!0;break;case"USER_UPDATED":this.handleUserUpdated(i);break}},async handleSignedIn(i){if(this.signedIn)return;this.signedIn=!0,this.togglePaywall(!1),document.getElementById("user-login-wrap").classList.remove("hidden"),document.getElementById("gdc-signup-user").innerHTML=i.session.user.user_metadata.display_name,document.getElementById("gdc-signup-text").classList.add("hidden"),document.getElementById("supabase-triggers").classList.add("hidden"),closeMobileNav();const e=await Le(i.session.user.email);$cookies.set("site_ktag_user",{site_user_id:i.session.user.id,email_sha256:e},"400d");const t=this.initSessionDetected?"login_form":"cookie";this.handleDataLayerEvent("freemium_user_loggedin",i.session.user.email,t),this.updateUser({customer_email:i.session.user.email,last_login:Math.floor(Date.now()/1e3)}),this.userPreference||this.getUserPreference({customer_email:i.session.user.email})},async handleSignedOut(i){document.getElementById("user-login-wrap").classList.add("hidden"),document.getElementById("supabase-triggers").classList.remove("hidden"),closeMobileNav(),this.signedIn=!1,this.blockContentComponent(),i.premium&&this.togglePaywall(!0)},async handleUserUpdated(i){const e=i.session.user.user_metadata;document.getElementById("gdc-signup-user").innerHTML=e.display_name||e.name,document.getElementById("gdc-signup-text").classList.add("hidden"),document.getElementById("supabase-triggers").classList.add("hidden"),closeMobileNav(),this.passwordRecoveryMode?(this.passwordRecoveryMode=!1,this.signedIn=!0,this.togglePaywall(!1),this.updateUser({customer_email:i.session.user.email,last_login:Math.floor(Date.now()/1e3)}),this.userPreference||this.getUserPreference({customer_email:i.session.user.email})):this.updateUser({customer_email:i.session.user.email,name:e.name,nickname:e.nickname,display_name:e.display_name})},async newUser(i){window.dispatchEvent(new CustomEvent("newuser",{detail:i}));try{const t=await(await fetch(`${this.supabaseWorkerAPI}/add-customer`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:this.supabaseWorkerToken},body:JSON.stringify({customer_email:i.email,name:i.name,nickname:i.nickname,display_name:i.display_name,phone_number:i.phone_number,register_method:"email",register_page_url:window.location.href,country:this.userGeo,state:this.userRegion,freemium_form:this.lastClickedButton,website_ref:"gambling_com"})})).json();if(t.success){const s={name:i.name,email:i.email,...i.phone_number&&i.phone_number!==""&&{phone:i.phone_number}};ktag.pushHashedData(s,"site registration"),this.handleDataLayerEvent("freemium_signup_successful",i.email)}else console.log("Error: "+t.message)}catch(e){console.log("Exception when adding user: "+e)}},async updateUser(i){try{const t=await(await fetch(`${this.supabaseWorkerAPI}/update-customer`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:this.supabaseWorkerToken},body:JSON.stringify(i)})).json();t.success||console.error("Error: "+t.message)}catch(e){console.error("Exception when updating user: "+e)}},async getUserPreference(i){try{const t=await(await fetch(`${this.supabaseWorkerAPI}/get-customer-details`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:this.supabaseWorkerToken},body:JSON.stringify(i)})).json();t.success?this.userPreference=t.data.customer:console.error("Error: "+t.message)}catch(e){console.error("Exception when getting user preference: "+e)}},async updateUserPreference(i){try{const t=await(await fetch(`${this.supabaseWorkerAPI}/update-customer-topics`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:this.supabaseWorkerToken},body:JSON.stringify(i)})).json();t.success||console.error("Error: "+t.message)}catch(e){console.error("Exception when updating user preference: "+e)}},createBlurSection(i){setTimeout(()=>{const e=document.body,t=document.getElementById("freemium-content-preview"),s=window.innerHeight,r=t?t.getBoundingClientRect().bottom+30+window.scrollY:s/2+100,n=t?e.scrollHeight:e.scrollHeight-s/2,o=document.createElement("div");o.classList.add("login-blurred-section"),o.style.height=`${n}px`,o.style.top=`${r}px`,e.appendChild(o),!this.signedIn&&i&&this.togglePaywall(!0)},2e3)},togglePaywall(i){if(i){if(/bot|googlebot|crawler|spider|robot|crawling/i.test(navigator.userAgent))return;window.addEventListener("scroll",this.updateBlurSectionHeight)}else window.removeEventListener("scroll",this.updateBlurSectionHeight),this.unblockContentComponent();const e=document.getElementById("login-content-blocker"),t=document.querySelector(".login-blurred-section");e&&(e.style.display=i?"block":"none"),t&&(t.style.display=i?"block":"none")},unblockContentComponent(){document.querySelectorAll(".component-blurr").forEach(i=>{i.style.filter="none",i.style.pointerEvents="auto",i.style.userSelect="auto"}),document.querySelectorAll(".component-modal").forEach(i=>{i.style.display="none"})},blockContentComponent(){document.querySelectorAll(".component-blurr").forEach(i=>{i.style.filter="blur(5px)",i.style.pointerEvents="none",i.style.userSelect="none"}),document.querySelectorAll(".component-modal").forEach(i=>{i.style.display="block"})},updateBlurSectionHeight(){clearTimeout(this.checkBlurSectionHeightInterval),this.checkBlurSectionHeightInterval=setTimeout(()=>{const i=document.getElementById("freemium-content-preview"),e=i?i.getBoundingClientRect().bottom+30+window.scrollY:window.innerHeight/2+100,t=document.querySelector(".login-blurred-section");t.style.top=`${e}px`,t.style.height=`${document.body.scrollHeight}px`},250)},async handleDataLayerEvent(i,e,t=null){let s=await Le(e);[i,"ktag"].map(n=>n!="ktag"?{event:n,email:e,hashed_email:s,...t!==null&&{method:t}}:{event:n,user_email_hash:s}).forEach(n=>{window.dataLayer.push(n)})}}}).mount("#modal-authentication-content")});